11.2. Determining Supported Extended Operations

For OpenDJ, the extended operations supported are listed in the Administration Guide appendix, LDAP Extended Operations. You can access the list of OIDs for supported LDAP controls by reading the supportedExtension attribute of the root DSE.

$ ldapsearch
 --baseDN ""
 --searchScope base
 --port 1389
 "(objectclass=*)" supportedExtension
dn: 
supportedExtension: 1.3.6.1.1.8
supportedExtension: 1.3.6.1.4.1.26027.1.6.1
supportedExtension: 1.3.6.1.4.1.26027.1.6.2
supportedExtension: 1.3.6.1.4.1.26027.1.6.3
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.3
supportedExtension: 1.3.6.1.4.1.1466.20037

The following excerpt shows code to check for supported extended operations.

/**
 * Controls supported by the LDAP server.
 */
private static Collection<String> extendedOperations;

/**
 * Populate the list of supported LDAP extended operation OIDs.
 * 
 * @param connection
 *            Active connection to the LDAP server.
 * @throws ErrorResultException
 *             Failed to get list of extended operations.
 */
static void checkSupportedExtendedOperations(Connection connection)
        throws ErrorResultException {
    extendedOperations = RootDSE.readRootDSE(connection)
            .getSupportedExtendedOperations();
}

/**
 * Check whether an extended operation is supported. Call
 * {@code checkSupportedExtendedOperations} first.
 * 
 * @param extendedOperation
 *            Check support for this extended operation, provided by OID.
 * @return True if the control is supported.
 */
static boolean isSupported(final String extendedOperation) {
    if (extendedOperations != null && !extendedOperations.isEmpty()) {
        return extendedOperations.contains(extendedOperation);
    }
    return false;
}