Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 59756 invoked from network); 29 Mar 2007 01:50:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Mar 2007 01:50:06 -0000 Received: (qmail 34553 invoked by uid 500); 29 Mar 2007 01:50:13 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 34527 invoked by uid 500); 29 Mar 2007 01:50:13 -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 34516 invoked by uid 99); 29 Mar 2007 01:50:12 -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 18:50:12 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of akarasulu@gmail.com designates 66.249.82.231 as permitted sender) Received: from [66.249.82.231] (HELO wx-out-0506.google.com) (66.249.82.231) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2007 18:50:04 -0700 Received: by wx-out-0506.google.com with SMTP id h31so38215wxd for ; Wed, 28 Mar 2007 18:49:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=LgUD8Y2M9Fbhndfqv5BfSsfTowe7lKi3cqh1URoG24AEdbtvETh+basJz0poSZ75vUl9r9mTbBL83vnWsjEr1tCD0C9YGvHvs4GOzgYuOqxOHSCVHA1gO7lqnXoCGpZyAD6euWVIyKiZj6Xr+4aUBmLfark9sZ0Q8mhJqayPRGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=EmNV8pB9zGOCZmQsex8LMG/skXQVVT2JY9UJKMso9gQcn1XPLjlKnq/Wy8MOmOdwInP1AMATkR/omXNnhsAM3mfUH/WN3IIZ/5JjClgD2XAIdt2CK3VLt03pkqiHvDjNwCroZRoO1l+UiqhOiz6A6zjZX0t6RhgXlSGqflS7rRc= Received: by 10.70.52.2 with SMTP id z2mr160706wxz.1175132983705; Wed, 28 Mar 2007 18:49:43 -0700 (PDT) Received: by 10.70.78.18 with HTTP; Wed, 28 Mar 2007 18:49:43 -0700 (PDT) Message-ID: Date: Wed, 28 Mar 2007 21:49:43 -0400 From: "Alex Karasulu" Sender: akarasulu@gmail.com To: "Apache Directory Developers List" Subject: Re: [Schema] How do I write a new ObjectClass to ApacheDS In-Reply-To: <460B1152.9030207@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_18276_15133014.1175132983638" References: <460AC99F.5030600@gmail.com> <460B1152.9030207@gmail.com> X-Google-Sender-Auth: 7ffa0401e355f28c X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_18276_15133014.1175132983638 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Ole, On 3/28/07, Ole Ersoy wrote: > Hey Alex, > > Yes - I think we're getting warmer! > > Here's the thing. Suppose I want to store an object that has String > members > > shoeSize > weight > height > name > > etc. > > I probably have name on some ObjectClass already defined in ApacheDS. > > However I still want to duplicate name on a completely different > ObjectClass. No problem. Really it does not matter; you can create a new xyzName attribute. Sometimes that's not so bad. Now I see that you want to autogenerate a schema from the Class metadata and creating the attributes for your objectClass with namespace qualification might be a good idea. > The ObjectClass I want has a 1:1 correspondence with the Java Class I > want to store. > That way a simple convention can be used to store the object, and no > configuration file > or index searching is needed to include a preexisting ObjectClass that > has the name attribute on it. Yep I agree (now that I understand your motives more) just create all the LDAP metadata you need on the fly to establish the mapping. > I guess I could create an index with all the LDAP attributeTypes and > look to see whether a certain attribute > already exists, and use it, but I think it's simpler just to create a > brand new ObjectClass. Nah don't bother. > Which leads me to another question. > > Can ObjectClass names have periods or underscores in them > > For Instance there's inetOrgPerson? > > Could it be > inet.org.person? I think so. > The reason I ask is because I want to create ObjectClasses on the fly > that are namespaced. Gotchya. SNIP ... Hope fishing was a blast. I'm sure you're really glad to out of the Sun, blue clear water, and cool breeze environment and be back in front of a monitor. Hey I still have a few more days to go :). It's not over yet. Regards, Alex Alex Karasulu wrote: > Hi Ole, > > Looks like you got some good advice already. Let me just add one more > suggestion > while you're looking into creating a schema. Sometimes you'll find > that the > attributeTypes and objectClasses you're looking for are already > defined in published > schemas. > > For example for users you might want to take a look at something like > inetOrgPerson etc. > > Second I suppose you're thinking of staying bleeding edge by using 1.5 > rather than using > 1.0. I'd recommend this. And if so then merely adding the schema > description entry for > the objectClass in the ou=schema partition in the appropriate place > should work. The schema > is dynamic in 1.5 but I guess Emmanuel and Stephan already pointed > this out. > > I will try to back read this thread. As you can imagine I have a lot > to catch up on since > I've been on vacation fishing all week :D. Yeah I don't miss LDAP he he. > > Regards, > Alex > > On 3/28/07, *Ole Ersoy* > wrote: > > Hey Guys, > > I'm in the middle of designing the DAS and > decided that I can probably make it way more efficient > if I create an ObjectClass per Java Class that I want to write to > ADS. > > So how do I programmatically create a ObjectClass and store it > in ApacheDS? > > Do we have a description somewhere or is this a standard JNDI thing? > > Here's a little further elaboration on what I want to do for those > interested. > > Keep in mind this is just an example. The Class User could be any > java > class used in a model. > > I have a Java Class >> User > > The Class User has String members [firstName, lastName, password] > > So I want to create a Structural ObjectClass in ApacheDS so that > I can add it as an attribute to the DN where a User instance will be > stored (The java object instance). > > If I were doing this in a relational database, I would create a table > definition instead of a ObjectClass. > > So I'm looking for something like this: > > ObjectClass objectClass = LDAPSchemaFactory.createObjectClass(); > objectClass.setName("User"); > ObjectClassAttribute objectClassAttribute = > LDAPSchemaFactory.createObjectClassAttribute(); > objectClassAttribute.setName("firstName"); > objectClassAttribute.setType(LDAP_STRING_ATTRIBUTE_TYPE); > > Then I would do something like: > > ctx.storeObjectClass(objectClass); > > The objectClass can now be assigned as an attribute to an ADS entry, > and if we were to look at all the ObjectClasses in ADS through > JXPlorer > or LDAP Studio, > we would see the User ObjectClass in the list. > > Does that make sense? > > Thanks, > - Ole > > > > > > ------=_Part_18276_15133014.1175132983638 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Ole,

On 3/28/07, Ole Ersoy <ole.ersoy@gmail.com> wrote:
Hey Alex,

Yes - I think we're getting warmer!

Here's the thing.  Suppose I want to store an object that has String members

shoeSize
weight
height
name

etc.

I probably have name on some ObjectClass already defined in ApacheDS.

However I still want to duplicate name on a completely different
ObjectClass.
 
No problem.  Really it does not matter; you can create a new xyzName attribute.  Sometimes that's not so bad.  Now I see that you want to autogenerate a schema from the Class
metadata and creating the attributes for your objectClass with namespace qualification might
be a good idea.

 
The ObjectClass I want has a 1:1 correspondence with the Java Class I
want to store.
That way a simple convention can be used to store the object, and no
configuration file
or index searching is needed to include a preexisting ObjectClass that
has the name attribute on it.
 
Yep I agree (now that I understand your motives more) just create all the LDAP
metadata you need on the fly to establish the mapping. 

 
I guess I could create an index with all the LDAP attributeTypes and
look to see whether a certain attribute
already exists, and use it, but I think it's simpler just to create a
brand new ObjectClass.
 
Nah don't bother.

 
Which leads me to another question.

Can ObjectClass names have periods or underscores in them

For Instance there's inetOrgPerson?

Could it be
inet.org.person?
 
I think so. 

 
The reason I ask is because I want to create ObjectClasses on the fly
that are namespaced.
 
Gotchya.

SNIP ...

Hope fishing was a blast.  I'm sure you're really glad to out of the
Sun, blue clear water,
and cool breeze environment and  be back in front of a monitor.
 
Hey I still have a few more days to go :).  It's not over yet.
 
Regards,
Alex

Alex Karasulu wrote:
> Hi Ole,
>
> Looks like you got some good advice already.  Let me just add one more
> suggestion
> while you're looking into creating a schema.  Sometimes you'll find
> that the
> attributeTypes and objectClasses you're looking for are already
> defined in published
> schemas.
>
> For example for users you might want to take a look at something like
> inetOrgPerson etc.
>
> Second I suppose you're thinking of staying bleeding edge by using 1.5
> rather than using
> 1.0.  I'd recommend this.  And if so then merely adding the schema
> description entry for
> the objectClass in the ou=schema partition in the appropriate place
> should work.  The schema
> is dynamic in 1.5 but I guess Emmanuel and Stephan already pointed
> this out.
>
> I will try to back read this thread.  As you can imagine I have a lot
> to catch up on since
> I've been on vacation fishing all week :D.  Yeah I don't miss LDAP he he.
>
> Regards,
> Alex
>
> On 3/28/07, *Ole Ersoy* <ole.ersoy@gmail.com
> <mailto:ole.ersoy@gmail.com>> wrote:
>
>     Hey Guys,
>
>     I'm in the middle of designing the DAS and
>     decided that I can probably make it way more efficient
>     if I create an ObjectClass per Java Class that I want to write to
>     ADS.
>
>     So how do I programmatically create a ObjectClass and store it
>     in ApacheDS?
>
>     Do we have a description somewhere or is this a standard JNDI thing?
>
>     Here's a little further elaboration on what I want to do for those
>     interested.
>
>     Keep in mind this is just an example.  The Class User could be any
>     java
>     class used in a model.
>
>     I have a Java Class >> User
>
>     The Class User has String members [firstName, lastName, password]
>
>     So I want to create a Structural ObjectClass in ApacheDS so that
>     I can add it as an attribute to the DN where a User instance will be
>     stored (The java object instance).
>
>     If I were doing this in a relational database, I would create a table
>     definition instead of a ObjectClass.
>
>     So I'm looking for something like this:
>
>     ObjectClass objectClass = LDAPSchemaFactory.createObjectClass();
>     objectClass.setName ("User");
>     ObjectClassAttribute objectClassAttribute =
>     LDAPSchemaFactory.createObjectClassAttribute();
>     objectClassAttribute.setName("firstName");
>     objectClassAttribute.setType (LDAP_STRING_ATTRIBUTE_TYPE);
>
>     Then I would do something like:
>
>     ctx.storeObjectClass(objectClass);
>
>     The objectClass can now be assigned as an attribute to an ADS entry,
>     and if we were to look at all the ObjectClasses in ADS through
>     JXPlorer
>     or LDAP Studio,
>     we would see the User ObjectClass in the list.
>
>     Does that make sense?
>
>     Thanks,
>     - Ole
>
>
>
>
>
>

 

------=_Part_18276_15133014.1175132983638--