0

I have a relatonal database with user/address data which I want to make accessible via LDAP. I am using apacheDS and am writing a custom partition. I can already return the entries from my database but I wonder what's the best way to impement searching/filtering.

This post: http://markmail.org/message/zxeu2xydfhspexbx#query:+page:1+mid:yxs6d7vnn7jqcmei+state:results indicates that filtering is a very complex thing (not just some "ifs"). It points to the implementation of the DefaultSearchEngine http://svn.apache.org/repos/asf/directory/apacheds/tags/1.5.5/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ but I don't understand how I can use that to search my database.

My questions are:

  1. Is there a way to define a mapping "LDAP attribute -> SQL table/column" (like "cn -> table Person, column FirstName") so I don't have to implement anything to make the search work?

  2. If not, is there an API that will parse the filtering expressions (like this: (&(cn=foo*)(sn=bar)) ) for me and I only have to implement a method like this: boolean matches(ServerEntry e, String attributeName, String value, ... comparisonType)

  3. If not, is there any other obvious/simple way to implement the search besides parsing the filtering expressions myself and implementing all the and, not, or logic and the database search?

I believe I'm not the only one with this kind of problem but I haven't found any helpful documentation or examples, and only one sourceforce project (penrose) without any sourcecode. I do appreciate any help you can offer. Thank you very much!

uschroe
  • 25
  • 2

1 Answers1

0

Take a look at this answer for a very similar requirement. You need not parse the filter, it is already available as a ExprNode and all you need is a simple LDAP-SQL translation layer depending on the needs.

kayyagari
  • 1,882
  • 13
  • 10