On Dec 17, 2007 2:12 PM, Alex Karasulu <akarasulu@apache.org> wrote:
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.

Sorry I should have gone further but I was rushing.  This code is intended to generate a schema if one does not already exist based on mapping rules or directives in the form of annotations.  It will also generate code for a Java POJO or POJI to do the basic CRUD and search operations needed.  I had some internal discussions with my split personalities on different flavors of API's to generate based on what was needed or what interested the user most like ones that leverage DAO based patterns or to leverage other patterns that are more conducive to the LDAP access model.  DAO's are very RDBMS oriented but can still be applicable to a degree although I see some problems in certain areas.

Theres lots to discuss.  I'm sure there will be some debates on how to proceed.  I had several with myself.  However if we could suspend being extremely critical and just get something out we could do this rapidly and adapt our approach after getting more user feedback.  This is not going to be perfect the first time it's implemented.