I’m implementing a custom partition on Apache DS (implementing org.apache.directory.server.core.partition.Partition).
I´m able to do searches on my custom partition, however if I want to use a filter (i.e. objectClass=”person”) my partition returns all the entries found, with no filtering at all.
Can anyone give an example of how to filter the entries returned by the “search” method using a custom partition?
Also, it would be highly appreciated if someone can point me to complete examples of implementing the search method. I need more information, specially regarding Search Scopes (OBJECT, ONELEVEL or SUBTREE).
I’m using version 1.5.5 of ApacheDS.
Thanks a lot!
I got this working some time ago but had no time to post the solution.
Based on the example of this page: How to write a simple custom partition for apache ds.
I was able to build the initial partition. This however was not useful to my case. It would be great if ApacheDS had a nicer documentation.
So for filtering, I got an email from the Apache Developers List basically explaining that there are no classes to help you at all, you must do it your self (please correct me if I’m wrong since I’m interested on improving my code soon).
For example, you got the filter (objectClass=person) then you should do something like this:
Actually, notice that the code example from above won’t work, since ApacheDS translates the attribute names to their corresponding OID. So, instead of “objectClass” we would get 2.5.6, which is the OID for “objectClass” attribute.
Now regarding search scopes, the answer from JPBlanc says pretty much about it so I’m not repeating what he said. On your custom partition you will need to write your code to handle the tree cases differently.
For example:
Regards.