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.5rather 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 <[EMAIL PROTECTED]> 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