[英]How can I delete ldap node and delete all the subtree node under it using Java?
[英]Java JNDI Delete entire LDAP subtree
我需要通过Java代码删除整个LDAP子树,例如ldapdelete命令的-r参数。 我怎样才能做到这一点? 有没有一种简单的方法可以使用JNDI删除整个LDAP子树?
如果服务器支持,则需要使用javax.naming.ldap.TreeDelete
控件,否则只能选择深度优先手动进行操作。
通常,仅在测试中才能删除LDAP中的整个子树。
无论如何,spring-Ldap测试实用程序中有一个实用程序类,称为LdaptestUtils,可以满足您的需求。 我不会在这里复制代码。 看看http://www.jarvana.com/jarvana/view/org/springframework/ldap/spring-ldap/1.3.0.RELEASE/spring-ldap-1.3.0.RELEASE-sources.jar!/org /springframework/ldap/test/LdapTestUtils.java?format=ok
相关的方法名称为clearSubContexts()(请注意重载)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.