Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 91915 invoked from network); 28 Mar 2007 22:37:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Mar 2007 22:37:40 -0000 Received: (qmail 22128 invoked by uid 500); 28 Mar 2007 22:37:44 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 22095 invoked by uid 500); 28 Mar 2007 22:37:44 -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 22066 invoked by uid 99); 28 Mar 2007 22:37:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2007 15:37:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of SRS0=KtIQ=JA=apache.org=seelmann@srs.kundenserver.de designates 212.227.126.183 as permitted sender) Received: from [212.227.126.183] (HELO moutng.kundenserver.de) (212.227.126.183) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2007 15:37:36 -0700 Received: from [84.57.6.2] (helo=[192.168.1.6]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2xA-1HWglW2CTH-0000e9; Thu, 29 Mar 2007 00:37:15 +0200 Message-ID: <460AEE40.3050503@apache.org> Date: Thu, 29 Mar 2007 00:37:52 +0200 From: Stefan Seelmann User-Agent: Thunderbird 1.5.0.7 (X11/20060922) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: [Schema] How do I write a new ObjectClass to ApacheDS References: <460AC99F.5030600@gmail.com> <460AD11F.6080103@gmail.com> <460ADFD2.1060402@gmail.com> In-Reply-To: <460ADFD2.1060402@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+T3+9Btz32vS52pPDGFMMImkuiZHOLAvYzPSX mMYYIfj8BKB6xRc3NoJBfPfP7iJR6hE+IHnnOcF6t2Bki74NHM C2Uy2OEG0zk8u+vLaI+sBWeARGHKsqiOcUHQC0+vMU= X-Virus-Checked: Checked by ClamAV on apache.org Ole Ersoy schrieb: > OH - OK - I think the lights are turning on. > > Suppose I have a > DN: cn=user1 ou=users, ou=system > > I can hang any attribute I want on this DN right? Yes, assumed that the attribute type is defined in the LDAP schema and the DN/entry has the object classes that allow that attribute. > > So if I want to store an instance of Java Class User (That has members > [userName:String, userPassword:string] > I could simply add the member values of a User instance as attributes to > the DN, and my object is effectively stored. > > If I want to get an instance of that object later, > the DAS just creates a user instance, and fetches the attributes using the > DN: cn=user1 ou=users, ou=system > context. > > In other words I get the attributes assigned to this context and > the ones that have the same name as the User Class members, would be > be assigned used to initialize the state of a User instance? Hm, JNDI defines a framework for doing such mappings between Java objects and LDAP entries: State Factories and Object Factories. Please see http://java.sun.com/products/jndi/tutorial/TOC.html, especially chapter 'Java Objects and the Directory'. > > So even thought userName has java type String, > I don't have to create a corresponding > LDAP ObjectClass named User that says that > userName is of LDAP attribute type String....., and then map the java > members > to the members of the User ObjectClass? For such a simple case you could just reuse the standard object class 'person' with its attributes 'cn' and 'userPassword'. But note that the userPassword attribute is defined as binary (Octet String) in RFC 4519. If your User Java class additionally has an attribute (e.g. 'shoeSize') that is not specified in an standard schema you could define an additional (AUXILIARY) object class in LDAP, e.g. 'customPerson' and an attribute type 'shoeSize' as may attribute. Then you could add this object class to the entry and then you could store the attribute 'shoeSize' to the entry. > > Thanks, > - Ole Stefan