mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
19.29.2014 177bf7e2e32a9ecdf3efe3e395cc27249830e6e3
Checkpoint OPENDJ-1343 Migrate dsconfig
- Added deleteSubtree as the 'subtree delete' control (1.2.840.113556.1.4.805) is not supported by the config
backend. [Thanks Matt!]
1 files modified
16 ■■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java 16 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
@@ -405,7 +405,7 @@
        // Delete the entry and any subordinate entries.
        DN dn = DNBuilder.create(path, profile);
        try {
            connection.deleteSubtree(dn.toString());
            deleteSubtree(dn);
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
@@ -557,6 +557,20 @@
        return d.resolveManagedObjectDefinition(resolver);
    }
    /*
     * Delete a subtree of entries. We cannot use the subtree delete control because it is not supported by the config
     * backend.
     */
    private void deleteSubtree(DN dn) throws ErrorResultException {
        // Delete the children first.
        for (DN child : listEntries(dn, Filter.objectClassPresent())) {
            deleteSubtree(child);
        }
        // Delete the named entry.
        connection.delete(dn.toString());
    }
    private Collection<DN> listEntries(DN dn, Filter filter) throws ErrorResultException {
        List<DN> names = new LinkedList<DN>();
        ConnectionEntryReader reader =