Hi Graham,

It's a please to hear from you again. 

On Dec 17, 2007 11:17 AM, Graham Leggett <minfrin@sharp.fm> wrote:
Has anybody heard of a Java package that does object to LDAP mapping,
along the lines of Hibernate or Torque in the land of SQL?

I think Castor had something out there and even Hibernate tried.  There's also this Spring LDAP stuff but that's not really an object mapping framework but rather more of a utility library that removes most of the redundant scaffolding used with JNDI code specifically.

There is a big void in this space and I have some ideas where we can fill that gap.  I started experimenting with a few things in the sandbox here:


The code experiments with a handful of simple ideas:

A default mapping scheme is used to map Classes to STRUCTURAL objectClasses and Interfaces to AUXILIARY objectClasses.  You probably can immediately infer on your own what abstract Java classes map to.  Java interface and class properties map to ldap attributes.   There is some level of smart inference we can make for most general cases to make sure the right things happen with regard to may and must lists.  Hence there is a default mapping scheme with some smart logic designed to handle most common cases in terms mentioned above and on how to handle syntaxes etc.   Also I think we can do some superb stuff with other concepts in both LDAP and Java like ditStructureRules, nameForms etc, and with things like Java aspects.  However we can talk about this later. This should cover about 60-80% of the mapping needs.

The rest of the user's needs can be accomodated with hints to the mapping engine using Java 5 Annotations. 

So this little experiment played with these concepts to see just how feasible this is and the amount of wattage we'd need to apply to get this done in a reasonable amount of time.  I am by no means attached to the code there.  I just tinkered so we can discard this and start fresh if you like.


You annotate a your classes, and interfaces their members or methods with tags

In other words, I would like a Java class hierarchy of objects
representing LDAP objectlasses and LDAP objects.

If such a thing doesn't exist, would the directory project be keen to
adopt such a new piece of code as its home, if it were to be written?