From dev-return-41350-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Tue Sep 11 14:43:18 2012 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 36F7AD605 for ; Tue, 11 Sep 2012 14:43:18 +0000 (UTC) Received: (qmail 89534 invoked by uid 500); 11 Sep 2012 14:43:18 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 89498 invoked by uid 500); 11 Sep 2012 14:43:18 -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 89491 invoked by uid 99); 11 Sep 2012 14:43:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2012 14:43:18 +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 pajbam@gmail.com designates 74.125.82.178 as permitted sender) Received: from [74.125.82.178] (HELO mail-we0-f178.google.com) (74.125.82.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2012 14:43:11 +0000 Received: by weyu7 with SMTP id u7so428313wey.37 for ; Tue, 11 Sep 2012 07:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:content-type:message-id:mime-version:subject:date :references:to:in-reply-to:x-mailer; bh=vNJO5f0zxEfsR1aVmNcPlM+9+x1x/hfcCxC+vrcpjc8=; b=kencJ1Ht5LjRTu9MEMsgMO/3WZHU5FXNBTDf30cTCNOU39VUqw6sd+g1uCCZ9VSkOP NZrrnPgofzkv3xZqE8IxQE+/KuoYGDtbMzS+PkYe6Ncn1YwWb6sG4OuJqnlxjVherJ2P l7hSfQuqUhQM88Y7kWRgCwv128N/NpcKFe6wD2nNtYXuj8U8ZFHbGIuqFiz+h6lyT+gY GBr2x3PnKVDLazfbBTzKr8X9DUeeeQjF4Zh4lWvYbUzgWFYdHEp6ES/zkmeybpiNQS7c RZk9oRobKfrGWLHnPtAfjn+JDAmbB5JZ6pdM64oIrUIYdOUCgl7WZLTgBNWqGVaRpiJ9 IAxA== Received: by 10.217.2.146 with SMTP id p18mr10401061wes.198.1347374570899; Tue, 11 Sep 2012 07:42:50 -0700 (PDT) Received: from [10.0.1.8] (def92-4-82-225-58-213.fbx.proxad.net. [82.225.58.213]) by mx.google.com with ESMTPS id cu1sm2858592wib.6.2012.09.11.07.42.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 07:42:50 -0700 (PDT) Sender: Pierre-Arnaud Marcelot From: Pierre-Arnaud Marcelot Content-Type: multipart/alternative; boundary="Apple-Mail=_08AF1476-D6D8-460C-9502-8E571FCD5136" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Subject: Re: Empty/Null Attribute Date: Tue, 11 Sep 2012 16:42:48 +0200 References: <504F3B56.4080501@gmail.com> To: "Apache Directory Developers List" In-Reply-To: X-Mailer: Apple Mail (2.1486) --Apple-Mail=_08AF1476-D6D8-460C-9502-8E571FCD5136 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 You could also try to use our Apache LDAP API instead of JNDI. =3D> http://directory.apache.org/api/downloads.html And, in code, what does 'ctls' look like? Can you show us the definition = ? Regards, Piere-Arnaud On 11 sept. 2012, at 16:35, Merve Temizer wrote: > According to page >=20 > = http://docs.oracle.com/javase/jndi/tutorial/basics/directory/getattrs.html= >=20 > I have tried >=20 > for (NamingEnumeration ae =3D sr.getAttributes().getAll(); = ae.hasMore();) { > Attribute attr =3D = (Attribute)ae.next(); > = System.out.println("attribute: " + attr.getID()); > /* Print each value */ > for (NamingEnumeration e =3D = attr.getAll(); e.hasMore(); > = System.out.println("value: " + e.next())); > } > Output: >=20 > attribute: dc > value: is > attribute: objectClass > value: extensibleObject > value: organizationalUnit > value: top >=20 > Can not see ou attribute. Sorry for simple questions but i did what = tutorial tells. >=20 >=20 > 2012/9/11 Emmanuel L=E9charny > Le 9/11/12 2:54 PM, Merve Temizer a =E9crit : >=20 > Hello, >=20 > I have some objectClasses and dc and ou attributes and their values, = in an > entry in LDAP. > I try to read ou attribute but i cant get it with below code. > I can get dc value correctly. > I know i must control if it is null, but why might "ou" be null = despite of > taking place in LDAP. >=20 > NamingEnumeration answer =3D ctx.search(searchBaseDn, filter, ctls); > try > { > while (answer.hasMore()) > { > SearchResult sr =3D (SearchResult) answer.next(); > OrganizationPojo organizationPojo =3D new OrganizationPojo(); > = organizationPojo.setOrgDc((String)sr.getAttributes().get("dc").get()); > = organizationPojo.setOrgOu((String)sr.getAttributes().get("ou").get()); >=20 > http://docs.oracle.com/javase/jndi/tutorial/ >=20 > --=20 > Regards, > Cordialement, > Emmanuel L=E9charny > www.iktek.com >=20 >=20 --Apple-Mail=_08AF1476-D6D8-460C-9502-8E571FCD5136 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 You = could also try to use our Apache LDAP API instead of = JNDI.


A= nd, in code, what does 'ctls' look like? Can you show us the definition = ?

Regards,
Piere-Arnaud

<= div>
On 11 sept. 2012, at 16:35, Merve Temizer <mervet2009@gmail.com> = wrote:

According to page


I have tried

for = (NamingEnumeration ae =3D sr.getAttributes().getAll(); ae.hasMore();) = {
=        Attribute = attr =3D (Attribute)ae.next();
=       =  System.out.println("attribute: " + attr.getID());
=        /* Print = each value */
=        for = (NamingEnumeration e =3D attr.getAll(); e.hasMore();
=     = System.out.println("value: " + e.next()));
=     = }
Output:

attribute: = dc
value: is
attribute: objectClass
value: = extensibleObject
value: organizationalUnit
value: = top

Can not see ou attribute. Sorry for = simple questions but i did what tutorial tells.


2012/9/11 Emmanuel = L=E9charny <elecharny@gmail.com>
Le 9/11/12 2:54 PM, Merve Temizer a =E9crit :

Hello,

I have some objectClasses and dc and ou attributes and their values, in = an
entry in LDAP.
I try to read ou attribute but i cant get it with below code.
I can get dc value correctly.
I know i must control if it is null, but why might "ou" be null despite = of
taking place in LDAP.

NamingEnumeration answer =3D ctx.search(searchBaseDn, filter, ctls);
        try
      {
          while (answer.hasMore())
          {
      SearchResult sr =3D (SearchResult) = answer.next();
      OrganizationPojo organizationPojo =3D new = OrganizationPojo();
      = organizationPojo.setOrgDc((String)sr.getAttributes().get("dc= ").get());
      = organizationPojo.setOrgOu((String)sr.getAttributes().get("ou= ").get());

http://docs.oracle.com/javase/jndi/tutorial/<= span class=3D"HOEnZb">

--
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com



= --Apple-Mail=_08AF1476-D6D8-460C-9502-8E571FCD5136--