如何在 ApacheDS 1.5.5 上实现自定义分区?
我正在 Apache DS 上实现自定义分区(实现 org.apache.directory.server.core.partition.Partition)。
我可以在我的自定义分区上进行搜索,但是如果我想使用过滤器(即 objectClass=”person”),我的分区将返回找到的所有条目,根本不进行任何过滤。
谁能举例说明如何使用自定义分区过滤“搜索”方法返回的条目?
另外,如果有人能指出我完成搜索方法实现的示例,我将不胜感激。我需要更多信息,特别是有关搜索范围(OBJECT、ONELEVEL 或 SUBTREE)的信息。
我使用的是 ApacheDS 1.5.5 版本。
多谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目录是一棵树。当您在目录中使用 LDAP 进行搜索(编写搜索协议数据单元)时,您给出:
对于深度,您有 3 种可能性
请注意 SCHEMA 中定义的类型的实现都是从
top
类型派生的。如果我以inetOrgPerson
类型为例,您可以在 SCHEMA 中看到该类型是organizationalPerson
的子级,而organizationalPerson
是person
的子级。 code>,它是top
的子级,在这种特殊情况下,inetOrgPerson
对象的objectClass
属性值将是 4 倍:因此,如果您使用 (&(objectClass=person)) 等过滤器编写搜索 PDU,您将获得从
person
、organizationalPerson
和inetOrPerson
类型发出的对象在你的结果中。某些搜索工具中的另一件事是,如果过滤器写得不好或不理解,则使用默认过滤器 ((&(objectClass=*)) (这意味着一切)。
A Directory is a tree. When you search (write a SEARCH Protocol Data Unit) with LDAP in a Directory you give :
For the deepness you've got 3 possibilities
If I come back to your problem. Be careful to the fact that there are implementation of type defined in the SCHEMA. Types are all derived from the type
top
. If I take as an example the typeinetOrgPerson
you can see in the SCHEMA that this type is a child oforganizationalPerson
, which is a chil ofperson
, which is a chil oftop
. In this particular case aninetOrgPerson
object will have hisobjectClass
attribute valued 4 times :So if you write a search PDU with a filter like (&(objectClass=person)) you will have objects issued from
person
,organizationalPerson
andinetOrPerson
types in your result.Another thing in some search tools if the filter is bad written or not understood the default filter ((&(objectClass=*)) is used (this means everything).
我前一段时间就开始工作了,但没有时间发布解决方案。
基于此页面的示例: 如何为 apache ds 编写一个简单的自定义分区。
我能够构建初始分区。然而,这对我的情况没有用。如果 ApacheDS 有更好的文档那就太好了。
因此,对于过滤,我收到了来自 Apache 开发人员列表的一封电子邮件,基本上解释说根本没有任何类可以帮助您,您必须自己完成(如果我错了,请纠正我,因为我有兴趣改进我的代码很快)。
例如,您获得了过滤器 (objectClass=person),那么您应该执行如下操作:
实际上,请注意上面的代码示例将不起作用,因为 ApacheDS 将属性名称转换为其相应的 OID。因此,我们将得到 2.5.6,而不是“objectClass”,它是“objectClass”属性的 OID。
现在关于搜索范围,JPBlanc 的答案已经说了很多,所以我不再重复他所说的。在您的自定义分区上,您将需要编写代码来以不同的方式处理树情况。
例如:
问候。
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.