Search in sources :

Example 1 with DNArgument

use of com.unboundid.util.args.DNArgument in project ldapsdk by pingidentity.

the class LDAPModify method addNonLDAPArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addNonLDAPArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    ldifFile = new FileArgument('f', ARG_LDIF_FILE, false, -1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_LDIF_FILE.get(), true, true, true, false);
    ldifFile.addLongIdentifier("filename", true);
    ldifFile.addLongIdentifier("ldif-file", true);
    ldifFile.addLongIdentifier("file-name", true);
    ldifFile.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(ldifFile);
    encryptionPassphraseFile = new FileArgument(null, "encryptionPassphraseFile", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_ENCRYPTION_PW_FILE.get(), true, true, true, false);
    encryptionPassphraseFile.addLongIdentifier("encryption-passphrase-file", true);
    encryptionPassphraseFile.addLongIdentifier("encryptionPasswordFile", true);
    encryptionPassphraseFile.addLongIdentifier("encryption-password-file", true);
    encryptionPassphraseFile.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(encryptionPassphraseFile);
    characterSet = new StringArgument('i', "characterSet", false, 1, INFO_LDAPMODIFY_PLACEHOLDER_CHARSET.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_CHARACTER_SET.get(), "UTF-8");
    characterSet.addLongIdentifier("encoding", true);
    characterSet.addLongIdentifier("character-set", true);
    characterSet.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(characterSet);
    rejectFile = new FileArgument('R', "rejectFile", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_REJECT_FILE.get(), false, true, true, false);
    rejectFile.addLongIdentifier("reject-file", true);
    rejectFile.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(rejectFile);
    verbose = new BooleanArgument('v', "verbose", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_VERBOSE.get());
    verbose.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(verbose);
    modifyEntriesMatchingFilter = new FilterArgument(null, "modifyEntriesMatchingFilter", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_ENTRIES_MATCHING_FILTER.get(ARG_SEARCH_PAGE_SIZE));
    modifyEntriesMatchingFilter.addLongIdentifier("modify-entries-matching-filter", true);
    modifyEntriesMatchingFilter.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(modifyEntriesMatchingFilter);
    modifyEntriesMatchingFiltersFromFile = new FileArgument(null, "modifyEntriesMatchingFiltersFromFile", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_FILTER_FILE.get(ARG_SEARCH_PAGE_SIZE), true, false, true, false);
    modifyEntriesMatchingFiltersFromFile.addLongIdentifier("modify-entries-matching-filters-from-file", true);
    modifyEntriesMatchingFiltersFromFile.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(modifyEntriesMatchingFiltersFromFile);
    modifyEntryWithDN = new DNArgument(null, "modifyEntryWithDN", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_ENTRY_DN.get());
    modifyEntryWithDN.addLongIdentifier("modify-entry-with-dn", true);
    modifyEntryWithDN.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(modifyEntryWithDN);
    modifyEntriesWithDNsFromFile = new FileArgument(null, "modifyEntriesWithDNsFromFile", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_DN_FILE.get(), true, false, true, false);
    modifyEntriesWithDNsFromFile.addLongIdentifier("modify-entries-with-dns-from-file", true);
    modifyEntriesWithDNsFromFile.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(modifyEntriesWithDNsFromFile);
    searchPageSize = new IntegerArgument(null, ARG_SEARCH_PAGE_SIZE, false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_SEARCH_PAGE_SIZE.get(modifyEntriesMatchingFilter.getIdentifierString(), modifyEntriesMatchingFiltersFromFile.getIdentifierString()), 1, Integer.MAX_VALUE);
    searchPageSize.addLongIdentifier("search-page-size", true);
    searchPageSize.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(searchPageSize);
    // NOTE:  The retryFailedOperations argument is now hidden, as we will retry
    // operations by default.  The neverRetry argument can be used to disable
    // this.
    retryFailedOperations = new BooleanArgument(null, "retryFailedOperations", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_RETRY_FAILED_OPERATIONS.get());
    retryFailedOperations.addLongIdentifier("retry-failed-operations", true);
    retryFailedOperations.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    retryFailedOperations.setHidden(true);
    parser.addArgument(retryFailedOperations);
    neverRetry = new BooleanArgument(null, "neverRetry", 1, INFO_LDAPMODIFY_ARG_DESC_NEVER_RETRY.get());
    neverRetry.addLongIdentifier("never-retry", true);
    neverRetry.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(neverRetry);
    dryRun = new BooleanArgument('n', "dryRun", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_DRY_RUN.get());
    dryRun.addLongIdentifier("dry-run", true);
    dryRun.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(dryRun);
    defaultAdd = new BooleanArgument('a', "defaultAdd", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_DEFAULT_ADD.get());
    defaultAdd.addLongIdentifier("default-add", true);
    defaultAdd.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(defaultAdd);
    continueOnError = new BooleanArgument('c', "continueOnError", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_CONTINUE_ON_ERROR.get());
    continueOnError.addLongIdentifier("continue-on-error", true);
    continueOnError.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(continueOnError);
    stripTrailingSpaces = new BooleanArgument(null, "stripTrailingSpaces", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_STRIP_TRAILING_SPACES.get());
    stripTrailingSpaces.addLongIdentifier("strip-trailing-spaces", true);
    stripTrailingSpaces.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    parser.addArgument(stripTrailingSpaces);
    followReferrals = new BooleanArgument(null, "followReferrals", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_FOLLOW_REFERRALS.get());
    followReferrals.addLongIdentifier("follow-referrals", true);
    followReferrals.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(followReferrals);
    proxyAs = new StringArgument('Y', "proxyAs", false, 1, INFO_PLACEHOLDER_AUTHZID.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_PROXY_AS.get());
    proxyAs.addLongIdentifier("proxyV2As", true);
    proxyAs.addLongIdentifier("proxy-as", true);
    proxyAs.addLongIdentifier("proxy-v2-as", true);
    proxyAs.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(proxyAs);
    proxyV1As = new DNArgument(null, "proxyV1As", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_PROXY_V1_AS.get());
    proxyV1As.addLongIdentifier("proxy-v1-as", true);
    proxyV1As.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(proxyV1As);
    useAdministrativeSession = new BooleanArgument(null, "useAdministrativeSession", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_USE_ADMIN_SESSION.get());
    useAdministrativeSession.addLongIdentifier("use-administrative-session", true);
    useAdministrativeSession.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(useAdministrativeSession);
    operationPurpose = new StringArgument(null, "operationPurpose", false, 1, INFO_PLACEHOLDER_PURPOSE.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_OPERATION_PURPOSE.get());
    operationPurpose.addLongIdentifier("operation-purpose", true);
    operationPurpose.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(operationPurpose);
    manageDsaIT = new BooleanArgument(null, "useManageDsaIT", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_MANAGE_DSA_IT.get());
    manageDsaIT.addLongIdentifier("manageDsaIT", true);
    manageDsaIT.addLongIdentifier("use-manage-dsa-it", true);
    manageDsaIT.addLongIdentifier("manage-dsa-it", true);
    manageDsaIT.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(manageDsaIT);
    useTransaction = new BooleanArgument(null, "useTransaction", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_USE_TRANSACTION.get());
    useTransaction.addLongIdentifier("use-transaction", true);
    useTransaction.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(useTransaction);
    final Set<String> multiUpdateErrorBehaviorAllowedValues = StaticUtils.setOf("atomic", "abort-on-error", "continue-on-error");
    multiUpdateErrorBehavior = new StringArgument(null, "multiUpdateErrorBehavior", false, 1, "{atomic|abort-on-error|continue-on-error}", INFO_LDAPMODIFY_ARG_DESCRIPTION_MULTI_UPDATE_ERROR_BEHAVIOR.get(), multiUpdateErrorBehaviorAllowedValues);
    multiUpdateErrorBehavior.addLongIdentifier("multi-update-error-behavior", true);
    multiUpdateErrorBehavior.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(multiUpdateErrorBehavior);
    assertionFilter = new FilterArgument(null, "assertionFilter", false, 1, INFO_PLACEHOLDER_FILTER.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ASSERTION_FILTER.get());
    assertionFilter.addLongIdentifier("assertion-filter", true);
    assertionFilter.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(assertionFilter);
    authorizationIdentity = new BooleanArgument('E', "authorizationIdentity", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_AUTHZ_IDENTITY.get());
    authorizationIdentity.addLongIdentifier("reportAuthzID", true);
    authorizationIdentity.addLongIdentifier("authorization-identity", true);
    authorizationIdentity.addLongIdentifier("report-authzID", true);
    authorizationIdentity.addLongIdentifier("report-authz-id", true);
    authorizationIdentity.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(authorizationIdentity);
    generatePassword = new BooleanArgument(null, "generatePassword", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_GENERATE_PASSWORD.get());
    generatePassword.addLongIdentifier("generatePW", true);
    generatePassword.addLongIdentifier("generate-password", true);
    generatePassword.addLongIdentifier("generate-pw", true);
    generatePassword.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(generatePassword);
    getAuthorizationEntryAttribute = new StringArgument(null, "getAuthorizationEntryAttribute", false, 0, INFO_PLACEHOLDER_ATTR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_GET_AUTHZ_ENTRY_ATTR.get());
    getAuthorizationEntryAttribute.addLongIdentifier("get-authorization-entry-attribute", true);
    getAuthorizationEntryAttribute.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(getAuthorizationEntryAttribute);
    getBackendSetID = new BooleanArgument(null, "getBackendSetID", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_GET_BACKEND_SET_ID.get());
    getBackendSetID.addLongIdentifier("get-backend-set-id", true);
    getBackendSetID.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(getBackendSetID);
    getRecentLoginHistory = new BooleanArgument(null, "getRecentLoginHistory", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_GET_RECENT_LOGIN_HISTORY.get());
    getRecentLoginHistory.addLongIdentifier("get-recent-login-history", true);
    getRecentLoginHistory.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(getRecentLoginHistory);
    getServerID = new BooleanArgument(null, "getServerID", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_GET_SERVER_ID.get());
    getServerID.addLongIdentifier("get-server-id", true);
    getServerID.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(getServerID);
    getUserResourceLimits = new BooleanArgument(null, "getUserResourceLimits", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_GET_USER_RESOURCE_LIMITS.get());
    getUserResourceLimits.addLongIdentifier("get-user-resource-limits", true);
    getUserResourceLimits.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(getUserResourceLimits);
    ignoreNoUserModification = new BooleanArgument(null, "ignoreNoUserModification", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_IGNORE_NO_USER_MOD.get());
    ignoreNoUserModification.addLongIdentifier("ignore-no-user-modification", true);
    ignoreNoUserModification.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(ignoreNoUserModification);
    preReadAttribute = new StringArgument(null, "preReadAttribute", false, -1, INFO_PLACEHOLDER_ATTR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_PRE_READ_ATTRIBUTE.get());
    preReadAttribute.addLongIdentifier("preReadAttributes", true);
    preReadAttribute.addLongIdentifier("pre-read-attribute", true);
    preReadAttribute.addLongIdentifier("pre-read-attributes", true);
    preReadAttribute.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(preReadAttribute);
    postReadAttribute = new StringArgument(null, "postReadAttribute", false, -1, INFO_PLACEHOLDER_ATTR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_POST_READ_ATTRIBUTE.get());
    postReadAttribute.addLongIdentifier("postReadAttributes", true);
    postReadAttribute.addLongIdentifier("post-read-attribute", true);
    postReadAttribute.addLongIdentifier("post-read-attributes", true);
    postReadAttribute.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(postReadAttribute);
    routeToBackendSet = new StringArgument(null, "routeToBackendSet", false, 0, INFO_LDAPMODIFY_ARG_PLACEHOLDER_ROUTE_TO_BACKEND_SET.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ROUTE_TO_BACKEND_SET.get());
    routeToBackendSet.addLongIdentifier("route-to-backend-set", true);
    routeToBackendSet.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(routeToBackendSet);
    routeToServer = new StringArgument(null, "routeToServer", false, 1, INFO_LDAPMODIFY_ARG_PLACEHOLDER_ROUTE_TO_SERVER.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ROUTE_TO_SERVER.get());
    routeToServer.addLongIdentifier("route-to-server", true);
    routeToServer.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(routeToServer);
    assuredReplication = new BooleanArgument(null, "useAssuredReplication", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_ASSURED_REPLICATION.get(ARG_ASSURED_REPLICATION_LOCAL_LEVEL, ARG_ASSURED_REPLICATION_REMOTE_LEVEL, ARG_ASSURED_REPLICATION_TIMEOUT));
    assuredReplication.addLongIdentifier("assuredReplication", true);
    assuredReplication.addLongIdentifier("use-assured-replication", true);
    assuredReplication.addLongIdentifier("assured-replication", true);
    assuredReplication.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(assuredReplication);
    final Set<String> assuredReplicationLocalLevelAllowedValues = StaticUtils.setOf("none", "received-any-server", "processed-all-servers");
    assuredReplicationLocalLevel = new StringArgument(null, ARG_ASSURED_REPLICATION_LOCAL_LEVEL, false, 1, INFO_PLACEHOLDER_LEVEL.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ASSURED_REPL_LOCAL_LEVEL.get(assuredReplication.getIdentifierString()), assuredReplicationLocalLevelAllowedValues);
    assuredReplicationLocalLevel.addLongIdentifier("assured-replication-local-level", true);
    assuredReplicationLocalLevel.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(assuredReplicationLocalLevel);
    final Set<String> assuredReplicationRemoteLevelAllowedValues = StaticUtils.setOf("none", "received-any-remote-location", "received-all-remote-locations", "processed-all-remote-servers");
    assuredReplicationRemoteLevel = new StringArgument(null, ARG_ASSURED_REPLICATION_REMOTE_LEVEL, false, 1, INFO_PLACEHOLDER_LEVEL.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ASSURED_REPL_REMOTE_LEVEL.get(assuredReplication.getIdentifierString()), assuredReplicationRemoteLevelAllowedValues);
    assuredReplicationRemoteLevel.addLongIdentifier("assured-replication-remote-level", true);
    assuredReplicationRemoteLevel.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(assuredReplicationRemoteLevel);
    assuredReplicationTimeout = new DurationArgument(null, ARG_ASSURED_REPLICATION_TIMEOUT, false, INFO_PLACEHOLDER_TIMEOUT.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_ASSURED_REPL_TIMEOUT.get(assuredReplication.getIdentifierString()));
    assuredReplicationTimeout.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(assuredReplicationTimeout);
    replicationRepair = new BooleanArgument(null, "replicationRepair", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_REPLICATION_REPAIR.get());
    replicationRepair.addLongIdentifier("replication-repair", true);
    replicationRepair.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(replicationRepair);
    nameWithEntryUUID = new BooleanArgument(null, "nameWithEntryUUID", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_NAME_WITH_ENTRY_UUID.get());
    nameWithEntryUUID.addLongIdentifier("name-with-entryUUID", true);
    nameWithEntryUUID.addLongIdentifier("name-with-entry-uuid", true);
    nameWithEntryUUID.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(nameWithEntryUUID);
    noOperation = new BooleanArgument(null, "noOperation", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_NO_OPERATION.get());
    noOperation.addLongIdentifier("noOp", true);
    noOperation.addLongIdentifier("no-operation", true);
    noOperation.addLongIdentifier("no-op", true);
    noOperation.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(noOperation);
    passwordUpdateBehavior = new StringArgument(null, "passwordUpdateBehavior", false, 0, INFO_LDAPMODIFY_PLACEHOLDER_NAME_EQUALS_VALUE.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_PW_UPDATE_BEHAVIOR.get());
    passwordUpdateBehavior.addLongIdentifier("password-update-behavior", true);
    passwordUpdateBehavior.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(passwordUpdateBehavior);
    passwordValidationDetails = new BooleanArgument(null, "getPasswordValidationDetails", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_PASSWORD_VALIDATION_DETAILS.get(ATTR_USER_PASSWORD, ATTR_AUTH_PASSWORD));
    passwordValidationDetails.addLongIdentifier("passwordValidationDetails", true);
    passwordValidationDetails.addLongIdentifier("get-password-validation-details", true);
    passwordValidationDetails.addLongIdentifier("password-validation-details", true);
    passwordValidationDetails.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(passwordValidationDetails);
    permissiveModify = new BooleanArgument(null, "permissiveModify", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_PERMISSIVE_MODIFY.get());
    permissiveModify.addLongIdentifier("permissive-modify", true);
    permissiveModify.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(permissiveModify);
    clientSideSubtreeDelete = new BooleanArgument(null, "clientSideSubtreeDelete", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_CLIENT_SIDE_SUBTREE_DELETE.get());
    clientSideSubtreeDelete.addLongIdentifier("client-side-subtree-delete", true);
    clientSideSubtreeDelete.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(clientSideSubtreeDelete);
    serverSideSubtreeDelete = new BooleanArgument(null, "serverSideSubtreeDelete", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_SERVER_SIDE_SUBTREE_DELETE.get());
    serverSideSubtreeDelete.addLongIdentifier("server-side-subtree-delete", true);
    serverSideSubtreeDelete.addLongIdentifier("subtreeDelete", true);
    serverSideSubtreeDelete.addLongIdentifier("subtree-delete", true);
    serverSideSubtreeDelete.addLongIdentifier("subtreeDeleteControl", true);
    serverSideSubtreeDelete.addLongIdentifier("subtree-delete-control", true);
    serverSideSubtreeDelete.addLongIdentifier("useSubtreeDeleteControl", true);
    serverSideSubtreeDelete.addLongIdentifier("use-subtree-delete-control", true);
    serverSideSubtreeDelete.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(serverSideSubtreeDelete);
    softDelete = new BooleanArgument('s', "softDelete", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_SOFT_DELETE.get());
    softDelete.addLongIdentifier("useSoftDelete", true);
    softDelete.addLongIdentifier("soft-delete", true);
    softDelete.addLongIdentifier("use-soft-delete", true);
    softDelete.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(softDelete);
    hardDelete = new BooleanArgument(null, "hardDelete", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_HARD_DELETE.get());
    hardDelete.addLongIdentifier("hard-delete", true);
    hardDelete.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(hardDelete);
    allowUndelete = new BooleanArgument(null, "allowUndelete", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_ALLOW_UNDELETE.get(ATTR_UNDELETE_FROM_DN));
    allowUndelete.addLongIdentifier("allow-undelete", true);
    allowUndelete.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(allowUndelete);
    retireCurrentPassword = new BooleanArgument(null, "retireCurrentPassword", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_RETIRE_CURRENT_PASSWORD.get(ATTR_USER_PASSWORD, ATTR_AUTH_PASSWORD));
    retireCurrentPassword.addLongIdentifier("retire-current-password", true);
    retireCurrentPassword.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(retireCurrentPassword);
    purgeCurrentPassword = new BooleanArgument(null, "purgeCurrentPassword", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_PURGE_CURRENT_PASSWORD.get(ATTR_USER_PASSWORD, ATTR_AUTH_PASSWORD));
    purgeCurrentPassword.addLongIdentifier("purge-current-password", true);
    purgeCurrentPassword.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(purgeCurrentPassword);
    final Set<String> suppressOperationalAttributeUpdatesAllowedValues = StaticUtils.setOf("last-access-time", "last-login-time", "last-login-ip", "lastmod");
    suppressOperationalAttributeUpdates = new StringArgument(null, "suppressOperationalAttributeUpdates", false, -1, INFO_PLACEHOLDER_ATTR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_SUPPRESS_OP_ATTR_UPDATES.get(), suppressOperationalAttributeUpdatesAllowedValues);
    suppressOperationalAttributeUpdates.addLongIdentifier("suppress-operational-attribute-updates", true);
    suppressOperationalAttributeUpdates.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(suppressOperationalAttributeUpdates);
    suppressReferentialIntegrityUpdates = new BooleanArgument(null, "suppressReferentialIntegrityUpdates", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_SUPPRESS_REFERINT_UPDATES.get());
    suppressReferentialIntegrityUpdates.addLongIdentifier("suppress-referential-integrity-updates", true);
    suppressReferentialIntegrityUpdates.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(suppressReferentialIntegrityUpdates);
    usePasswordPolicyControl = new BooleanArgument(null, "usePasswordPolicyControl", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_PASSWORD_POLICY.get());
    usePasswordPolicyControl.addLongIdentifier("use-password-policy-control", true);
    usePasswordPolicyControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(usePasswordPolicyControl);
    uniquenessAttribute = new StringArgument(null, "uniquenessAttribute", false, 0, INFO_PLACEHOLDER_ATTR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_ATTR.get());
    uniquenessAttribute.addLongIdentifier("uniquenessAttributeType", true);
    uniquenessAttribute.addLongIdentifier("uniqueAttribute", true);
    uniquenessAttribute.addLongIdentifier("uniqueAttributeType", true);
    uniquenessAttribute.addLongIdentifier("uniqueness-attribute", true);
    uniquenessAttribute.addLongIdentifier("uniqueness-attribute-type", true);
    uniquenessAttribute.addLongIdentifier("unique-attribute", true);
    uniquenessAttribute.addLongIdentifier("unique-attribute-type", true);
    uniquenessAttribute.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessAttribute);
    uniquenessFilter = new FilterArgument(null, "uniquenessFilter", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_FILTER.get());
    uniquenessFilter.addLongIdentifier("uniqueness-filter", true);
    uniquenessFilter.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessFilter);
    uniquenessBaseDN = new DNArgument(null, "uniquenessBaseDN", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_BASE_DN.get());
    uniquenessBaseDN.addLongIdentifier("uniqueness-base-dn", true);
    uniquenessBaseDN.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessBaseDN);
    parser.addDependentArgumentSet(uniquenessBaseDN, uniquenessAttribute, uniquenessFilter);
    final Set<String> mabValues = StaticUtils.setOf("unique-within-each-attribute", "unique-across-all-attributes-including-in-same-entry", "unique-across-all-attributes-except-in-same-entry", "unique-in-combination");
    uniquenessMultipleAttributeBehavior = new StringArgument(null, "uniquenessMultipleAttributeBehavior", false, 1, INFO_LDAPMODIFY_PLACEHOLDER_BEHAVIOR.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_MULTIPLE_ATTRIBUTE_BEHAVIOR.get(), mabValues);
    uniquenessMultipleAttributeBehavior.addLongIdentifier("uniqueness-multiple-attribute-behavior", true);
    uniquenessMultipleAttributeBehavior.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessMultipleAttributeBehavior);
    parser.addDependentArgumentSet(uniquenessMultipleAttributeBehavior, uniquenessAttribute);
    final Set<String> vlValues = StaticUtils.setOf("none", "all-subtree-views", "all-backend-sets", "all-available-backend-servers");
    uniquenessPreCommitValidationLevel = new StringArgument(null, "uniquenessPreCommitValidationLevel", false, 1, INFO_LDAPMODIFY_PLACEHOLDER_LEVEL.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_PRE_COMMIT_LEVEL.get(), vlValues);
    uniquenessPreCommitValidationLevel.addLongIdentifier("uniqueness-pre-commit-validation-level", true);
    uniquenessPreCommitValidationLevel.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessPreCommitValidationLevel);
    parser.addDependentArgumentSet(uniquenessPreCommitValidationLevel, uniquenessAttribute, uniquenessFilter);
    uniquenessPostCommitValidationLevel = new StringArgument(null, "uniquenessPostCommitValidationLevel", false, 1, INFO_LDAPMODIFY_PLACEHOLDER_LEVEL.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_UNIQUE_POST_COMMIT_LEVEL.get(), vlValues);
    uniquenessPostCommitValidationLevel.addLongIdentifier("uniqueness-post-commit-validation-level", true);
    uniquenessPostCommitValidationLevel.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(uniquenessPostCommitValidationLevel);
    parser.addDependentArgumentSet(uniquenessPostCommitValidationLevel, uniquenessAttribute, uniquenessFilter);
    operationControl = new ControlArgument('J', "control", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_OP_CONTROL.get());
    operationControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(operationControl);
    addControl = new ControlArgument(null, "addControl", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_ADD_CONTROL.get());
    addControl.addLongIdentifier("add-control", true);
    addControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(addControl);
    bindControl = new ControlArgument(null, "bindControl", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_BIND_CONTROL.get());
    bindControl.addLongIdentifier("bind-control", true);
    bindControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(bindControl);
    deleteControl = new ControlArgument(null, "deleteControl", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_DELETE_CONTROL.get());
    deleteControl.addLongIdentifier("delete-control", true);
    deleteControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(deleteControl);
    modifyControl = new ControlArgument(null, "modifyControl", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_CONTROL.get());
    modifyControl.addLongIdentifier("modify-control", true);
    modifyControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(modifyControl);
    modifyDNControl = new ControlArgument(null, "modifyDNControl", false, 0, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_MODIFY_DN_CONTROL.get());
    modifyDNControl.addLongIdentifier("modify-dn-control", true);
    modifyDNControl.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_CONTROLS.get());
    parser.addArgument(modifyDNControl);
    ratePerSecond = new IntegerArgument('r', "ratePerSecond", false, 1, INFO_PLACEHOLDER_NUM.get(), INFO_LDAPMODIFY_ARG_DESCRIPTION_RATE_PER_SECOND.get(), 1, Integer.MAX_VALUE);
    ratePerSecond.addLongIdentifier("rate-per-second", true);
    ratePerSecond.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_OPS.get());
    parser.addArgument(ratePerSecond);
    // The "--scriptFriendly" argument is provided for compatibility with legacy
    // ldapmodify tools, but is not actually used by this tool.
    final BooleanArgument scriptFriendly = new BooleanArgument(null, "scriptFriendly", 1, INFO_LDAPMODIFY_ARG_DESCRIPTION_SCRIPT_FRIENDLY.get());
    scriptFriendly.addLongIdentifier("script-friendly", true);
    scriptFriendly.setArgumentGroupName(INFO_LDAPMODIFY_ARG_GROUP_DATA.get());
    scriptFriendly.setHidden(true);
    parser.addArgument(scriptFriendly);
    // The "-V" / "--ldapVersion" argument is provided for compatibility with
    // legacy ldapmodify tools, but is not actually used by this tool.
    final IntegerArgument ldapVersion = new IntegerArgument('V', "ldapVersion", false, 1, null, INFO_LDAPMODIFY_ARG_DESCRIPTION_LDAP_VERSION.get());
    ldapVersion.addLongIdentifier("ldap-version", true);
    ldapVersion.setHidden(true);
    parser.addArgument(ldapVersion);
    // A few assured replication arguments will only be allowed if assured
    // replication is to be used.
    parser.addDependentArgumentSet(assuredReplicationLocalLevel, assuredReplication);
    parser.addDependentArgumentSet(assuredReplicationRemoteLevel, assuredReplication);
    parser.addDependentArgumentSet(assuredReplicationTimeout, assuredReplication);
    // Transactions will be incompatible with a lot of settings.
    parser.addExclusiveArgumentSet(useTransaction, multiUpdateErrorBehavior);
    parser.addExclusiveArgumentSet(useTransaction, rejectFile);
    parser.addExclusiveArgumentSet(useTransaction, retryFailedOperations);
    parser.addExclusiveArgumentSet(useTransaction, continueOnError);
    parser.addExclusiveArgumentSet(useTransaction, dryRun);
    parser.addExclusiveArgumentSet(useTransaction, followReferrals);
    parser.addExclusiveArgumentSet(useTransaction, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(useTransaction, noOperation);
    parser.addExclusiveArgumentSet(useTransaction, modifyEntriesMatchingFilter);
    parser.addExclusiveArgumentSet(useTransaction, modifyEntriesMatchingFiltersFromFile);
    parser.addExclusiveArgumentSet(useTransaction, modifyEntryWithDN);
    parser.addExclusiveArgumentSet(useTransaction, modifyEntriesWithDNsFromFile);
    parser.addExclusiveArgumentSet(useTransaction, clientSideSubtreeDelete);
    // Multi-update is incompatible with a lot of settings.
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, ratePerSecond);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, rejectFile);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, retryFailedOperations);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, continueOnError);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, dryRun);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, followReferrals);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, noOperation);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, modifyEntriesMatchingFilter);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, modifyEntriesMatchingFiltersFromFile);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, modifyEntryWithDN);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, modifyEntriesWithDNsFromFile);
    parser.addExclusiveArgumentSet(multiUpdateErrorBehavior, clientSideSubtreeDelete);
    // Client-side and server-side subtree deletes cannot be used together.
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, serverSideSubtreeDelete);
    // Soft delete cannot be used with either hard delete or subtree delete.
    parser.addExclusiveArgumentSet(softDelete, hardDelete);
    parser.addExclusiveArgumentSet(softDelete, clientSideSubtreeDelete);
    parser.addExclusiveArgumentSet(softDelete, serverSideSubtreeDelete);
    // Client-side subtree delete cannot be used in conjunction with a few
    // other settings.
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, followReferrals);
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, preReadAttribute);
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, getBackendSetID);
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, getServerID);
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, noOperation);
    parser.addExclusiveArgumentSet(clientSideSubtreeDelete, dryRun);
    // Password retiring and purging can't be used together.
    parser.addExclusiveArgumentSet(retireCurrentPassword, purgeCurrentPassword);
    // Referral following cannot be used in conjunction with the manageDsaIT
    // control.
    parser.addExclusiveArgumentSet(followReferrals, manageDsaIT);
    // The proxyAs and proxyV1As arguments cannot be used together.
    parser.addExclusiveArgumentSet(proxyAs, proxyV1As);
    // The modifyEntriesMatchingFilter argument is incompatible with a lot of
    // settings, since it can only be used for modify operations.
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, allowUndelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, defaultAdd);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, dryRun);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, hardDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, ignoreNoUserModification);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, softDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, clientSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, serverSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, suppressReferentialIntegrityUpdates);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, addControl);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, deleteControl);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFilter, modifyDNControl);
    // The modifyEntriesMatchingFilterFromFile argument is incompatible with a
    // lot of settings, since it can only be used for modify operations.
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, allowUndelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, defaultAdd);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, dryRun);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, hardDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, ignoreNoUserModification);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, softDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, clientSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, serverSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, suppressReferentialIntegrityUpdates);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, addControl);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, deleteControl);
    parser.addExclusiveArgumentSet(modifyEntriesMatchingFiltersFromFile, modifyDNControl);
    // The modifyEntryWithDN argument is incompatible with a lot of
    // settings, since it can only be used for modify operations.
    parser.addExclusiveArgumentSet(modifyEntryWithDN, allowUndelete);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, defaultAdd);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, dryRun);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, hardDelete);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, ignoreNoUserModification);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, softDelete);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, clientSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, serverSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, suppressReferentialIntegrityUpdates);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, addControl);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, deleteControl);
    parser.addExclusiveArgumentSet(modifyEntryWithDN, modifyDNControl);
    // The modifyEntriesWithDNsFromFile argument is incompatible with a lot of
    // settings, since it can only be used for modify operations.
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, allowUndelete);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, defaultAdd);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, dryRun);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, hardDelete);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, ignoreNoUserModification);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, nameWithEntryUUID);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, softDelete);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, clientSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, serverSideSubtreeDelete);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, suppressReferentialIntegrityUpdates);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, addControl);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, deleteControl);
    parser.addExclusiveArgumentSet(modifyEntriesWithDNsFromFile, modifyDNControl);
}
Also used : ControlArgument(com.unboundid.util.args.ControlArgument) DNArgument(com.unboundid.util.args.DNArgument) DurationArgument(com.unboundid.util.args.DurationArgument) FilterArgument(com.unboundid.util.args.FilterArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Example 2 with DNArgument

use of com.unboundid.util.args.DNArgument in project ldapsdk by pingidentity.

the class LDAPPasswordModify method getUserIdentity.

/**
 * Retrieves the user identity for whom to update the password.
 *
 * @param  pool               A connection pool to use to communicate with the
 *                            directory server, if necessary.  This may be
 *                            {@code null} if only an explicitly provided user
 *                            identity should be used.  If it is
 *                            non-{@code null}, then an attempt will be made
 *                            to infer the correct value, and the value
 *                            returned will be a DN.
 * @param  isActiveDirectory  Indicates whether the target directory server
 *                            is believed to be an Active Directory instance.
 *
 * @return  The user identity for whom to update the password.
 *
 * @throws  LDAPException  If a problem occurs while attempting to obtain the
 *                         user identity.
 */
@NotNull()
private String getUserIdentity(@NotNull final LDAPConnectionPool pool, final boolean isActiveDirectory) throws LDAPException {
    String identity = null;
    final DNArgument bindDNArgument = argumentParser.getDNArgument(BIND_DN_ARGUMENT_LONG_IDENTIFIER);
    if (userIdentity.isPresent()) {
        identity = userIdentity.getValue();
    } else if (provideBindDNAsUserIdentity.isPresent()) {
        identity = bindDNArgument.getStringValue();
        if ((pool == null) && verbose.isPresent()) {
            out();
            wrapOut(0, WRAP_COLUMN, INFO_PWMOD_USING_USER_IDENTITY_FROM_DN_FOR_EXTOP.get(identity));
        }
    } else {
        if ((pool == null) && verbose.isPresent()) {
            out();
            wrapOut(0, WRAP_COLUMN, INFO_PWMOD_OMITTING_USER_IDENTITY_FROM_EXTOP.get());
        }
    }
    if (pool == null) {
        return identity;
    }
    if (identity == null) {
        if (bindDNArgument.isPresent()) {
            final DN bindDN = bindDNArgument.getValue();
            if (!bindDN.isNullDN()) {
                return bindDN.toString();
            }
        }
        final WhoAmIExtendedRequest whoAmIRequest = new WhoAmIExtendedRequest();
        try {
            final WhoAmIExtendedResult whoAmIResult = (WhoAmIExtendedResult) pool.processExtendedOperation(whoAmIRequest);
            if (whoAmIResult.getResultCode() == ResultCode.SUCCESS) {
                identity = whoAmIResult.getAuthorizationID();
            }
        } catch (final LDAPException e) {
            Debug.debugException(e);
        }
    }
    if (identity == null) {
        throw new LDAPException(ResultCode.PARAM_ERROR, ERR_PWMOD_CANNOT_DETERMINE_USER_IDENTITY.get(userIdentity.getIdentifierString()));
    }
    final String userDN;
    final String lowerIdentity = StaticUtils.toLowerCase(identity);
    if (lowerIdentity.startsWith("dn:")) {
        userDN = identity.substring(3).trim();
    } else if (lowerIdentity.startsWith("u:")) {
        final String username = identity.substring(2).trim();
        if (username.isEmpty()) {
            throw new LDAPException(ResultCode.PARAM_ERROR, ERR_PWMOD_USER_IDENTITY_EMPTY_USERNAME.get(userIdentity.getIdentifierString()));
        }
        userDN = searchForUser(pool, username, isActiveDirectory);
    } else {
        userDN = identity;
    }
    final DN parsedUserDN;
    try {
        parsedUserDN = new DN(userDN);
    } catch (final LDAPException e) {
        Debug.debugException(e);
        throw new LDAPException(ResultCode.PARAM_ERROR, ERR_PWMOD_USER_IDENTITY_NOT_VALID_DN.get(userDN, userIdentity.getIdentifierString()), e);
    }
    if (parsedUserDN.isNullDN()) {
        throw new LDAPException(ResultCode.PARAM_ERROR, ERR_PWMOD_USER_IDENTITY_EMPTY_DN.get(userIdentity.getIdentifierString()));
    }
    if (verbose.isPresent()) {
        out();
        INFO_PWMOD_USER_IDENTITY_DN_FOR_MOD.get(userDN);
    }
    return userDN;
}
Also used : WhoAmIExtendedResult(com.unboundid.ldap.sdk.extensions.WhoAmIExtendedResult) DNArgument(com.unboundid.util.args.DNArgument) LDAPException(com.unboundid.ldap.sdk.LDAPException) WhoAmIExtendedRequest(com.unboundid.ldap.sdk.extensions.WhoAmIExtendedRequest) DN(com.unboundid.ldap.sdk.DN) NotNull(com.unboundid.util.NotNull)

Example 3 with DNArgument

use of com.unboundid.util.args.DNArgument in project ldapsdk by pingidentity.

the class LDAPPasswordModify method addNonLDAPArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addNonLDAPArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    argumentParser = parser;
    // Authorization identity arguments.
    userIdentity = new StringArgument('a', "userIdentity", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_DN_OR_AUTHZID.get(), INFO_PWMOD_ARG_DESC_USER_IDENTITY.get());
    userIdentity.addLongIdentifier("user-identity", true);
    userIdentity.addLongIdentifier("userDN", true);
    userIdentity.addLongIdentifier("user-dn", true);
    userIdentity.addLongIdentifier("authzID", true);
    userIdentity.addLongIdentifier("authz-id", true);
    userIdentity.addLongIdentifier("authorizationID", true);
    userIdentity.addLongIdentifier("authorization-id", true);
    userIdentity.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_USER_IDENTITY.get());
    parser.addArgument(userIdentity);
    provideBindDNAsUserIdentity = new BooleanArgument('A', "provideBindDNAsUserIdentity", 1, INFO_PWMOD_ARG_DESC_PROVIDE_BIND_DN_AS_USER_IDENTITY.get());
    provideBindDNAsUserIdentity.addLongIdentifier("provide-bind-dn-as-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provideBindDNForUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provide-bind-dn-for-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provideDNAsUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provide-dn-as-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provideDNForUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provide-dn-for-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("useBindDNAsUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("use-bind-dn-as-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("useBindDNForUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("use-bind-dn-for-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("useDNAsUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("use-dn-as-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("useDNForUserIdentity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("use-dn-for-user-identity", true);
    provideBindDNAsUserIdentity.addLongIdentifier("useBindDNForAuthzID", true);
    provideBindDNAsUserIdentity.addLongIdentifier("use-bind-dn-for-authz-id", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provideDNForAuthzID", true);
    provideBindDNAsUserIdentity.addLongIdentifier("provide-dn-for-authz-id", true);
    provideBindDNAsUserIdentity.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_USER_IDENTITY.get());
    parser.addArgument(provideBindDNAsUserIdentity);
    usernameAttribute = new StringArgument(null, "usernameAttribute", false, 0, INFO_PWMOD_ARG_PLACEHOLDER_ATTRIBUTE_NAME.get(), INFO_PWMOD_ARG_DESC_USERNAME_ATTRIBUTE.get());
    usernameAttribute.addLongIdentifier("username-attribute", true);
    usernameAttribute.addLongIdentifier("usernameAttr", true);
    usernameAttribute.addLongIdentifier("username-attr", true);
    usernameAttribute.addLongIdentifier("userIDAttribute", true);
    usernameAttribute.addLongIdentifier("user-id-attribute", true);
    usernameAttribute.addLongIdentifier("userIDAttr", true);
    usernameAttribute.addLongIdentifier("user-id-attr", true);
    usernameAttribute.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_USER_IDENTITY.get());
    parser.addArgument(usernameAttribute);
    searchBaseDN = new DNArgument('b', "searchBaseDN", false, 0, null, INFO_PWMOD_ARG_DESC_SEARCH_BASE_DN.get(), DN.NULL_DN);
    searchBaseDN.addLongIdentifier("search-base-dn", true);
    searchBaseDN.addLongIdentifier("baseDN", true);
    searchBaseDN.addLongIdentifier("base-dn", true);
    searchBaseDN.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_USER_IDENTITY.get());
    parser.addArgument(searchBaseDN);
    // New password arguments.
    newPassword = new StringArgument('n', "newPassword", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_PASSWORD.get(), INFO_PWMOD_ARG_DESC_NEW_PASSWORD.get());
    newPassword.addLongIdentifier("new-password", true);
    newPassword.addLongIdentifier("newPW", true);
    newPassword.addLongIdentifier("new-pw", true);
    newPassword.addLongIdentifier("new", true);
    newPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(newPassword);
    newPasswordFile = new FileArgument('N', "newPasswordFile", false, 1, null, INFO_PWMOD_ARG_DESC_NEW_PASSWORD_FILE.get(), true, true, true, false);
    newPasswordFile.addLongIdentifier("new-password-file", true);
    newPasswordFile.addLongIdentifier("newPWFile", true);
    newPasswordFile.addLongIdentifier("new-pw-file", true);
    newPasswordFile.addLongIdentifier("newFile", true);
    newPasswordFile.addLongIdentifier("new-file", true);
    newPasswordFile.addLongIdentifier("newPasswordPath", true);
    newPasswordFile.addLongIdentifier("new-password-path", true);
    newPasswordFile.addLongIdentifier("newPWPath", true);
    newPasswordFile.addLongIdentifier("new-pw-path", true);
    newPasswordFile.addLongIdentifier("newPath", true);
    newPasswordFile.addLongIdentifier("new-path", true);
    newPasswordFile.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(newPasswordFile);
    promptForNewPassword = new BooleanArgument(null, "promptForNewPassword", 1, INFO_PWMOD_ARG_DESC_PROMPT_FOR_NEW_PASSWORD.get());
    promptForNewPassword.addLongIdentifier("prompt-for-new-password", true);
    promptForNewPassword.addLongIdentifier("promptForNewPW", true);
    promptForNewPassword.addLongIdentifier("prompt-for-new-pw", true);
    promptForNewPassword.addLongIdentifier("promptForNew", true);
    promptForNewPassword.addLongIdentifier("prompt-for-new", true);
    promptForNewPassword.addLongIdentifier("promptNew", true);
    promptForNewPassword.addLongIdentifier("prompt-new", true);
    promptForNewPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(promptForNewPassword);
    generateClientSideNewPassword = new BooleanArgument(null, "generateClientSideNewPassword", 1, INFO_PWMOD_ARG_DESC_GENERATE_CLIENT_SIDE_NEW_PASSWORD.get());
    generateClientSideNewPassword.addLongIdentifier("generate-client-side-new-password", true);
    generateClientSideNewPassword.addLongIdentifier("generateClientSideNewPW", true);
    generateClientSideNewPassword.addLongIdentifier("generate-client-side-new-pw", true);
    generateClientSideNewPassword.addLongIdentifier("generateNewPassword", true);
    generateClientSideNewPassword.addLongIdentifier("generate-new-password", true);
    generateClientSideNewPassword.addLongIdentifier("generateNewPW", true);
    generateClientSideNewPassword.addLongIdentifier("generate-new-pw", true);
    generateClientSideNewPassword.addLongIdentifier("generatePassword", true);
    generateClientSideNewPassword.addLongIdentifier("generate-password", true);
    generateClientSideNewPassword.addLongIdentifier("generatePW", true);
    generateClientSideNewPassword.addLongIdentifier("generate-pw", true);
    generateClientSideNewPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(generateClientSideNewPassword);
    generatedPasswordLength = new IntegerArgument(null, "generatedPasswordLength", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_LENGTH.get(), INFO_PWMOD_ARG_DESC_GENERATED_PASSWORD_LENGTH.get(), 1, Integer.MAX_VALUE, 12);
    generatedPasswordLength.addLongIdentifier("generated-password-length", true);
    generatedPasswordLength.addLongIdentifier("generatedPWLength", true);
    generatedPasswordLength.addLongIdentifier("generated-pw-length", true);
    generatedPasswordLength.addLongIdentifier("passwordLength", true);
    generatedPasswordLength.addLongIdentifier("password-length", true);
    generatedPasswordLength.addLongIdentifier("pwLength", true);
    generatedPasswordLength.addLongIdentifier("pw-length", true);
    generatedPasswordLength.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(generatedPasswordLength);
    generatedPasswordCharacterSet = new StringArgument(null, "generatedPasswordCharacterSet", false, 0, INFO_PWMOD_ARG_PLACEHOLDER_CHARS.get(), INFO_PWMOD_ARG_DESC_GENERATED_PASSWORD_CHARACTER_SET.get(), null, Collections.unmodifiableList(Arrays.asList(// Note that some letters and
    "abcdefghijmnopqrstuvwxyz", // digits are missing in an attempt
    "ABCDEFGHJLMNPQRSTUVWXYZ", // to avoid ambiguous characters.
    "23456789", "@#-_=+.")));
    generatedPasswordCharacterSet.addLongIdentifier("generated-password-character-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPWCharacterSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-pw-character-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPasswordCharSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-password-char-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-password-charset", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPWCharSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-pw-char-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-pw-charset", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPasswordCharacters", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-password-characters", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPWCharacters", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-pw-characters", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPasswordChars", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-password-chars", true);
    generatedPasswordCharacterSet.addLongIdentifier("generatedPWChars", true);
    generatedPasswordCharacterSet.addLongIdentifier("generated-pw-chars", true);
    generatedPasswordCharacterSet.addLongIdentifier("passwordCharacters", true);
    generatedPasswordCharacterSet.addLongIdentifier("password-characters", true);
    generatedPasswordCharacterSet.addLongIdentifier("pwCharacters", true);
    generatedPasswordCharacterSet.addLongIdentifier("pw-characters", true);
    generatedPasswordCharacterSet.addLongIdentifier("passwordCharacterSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("password-character-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("pwCharacterSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("pw-character-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("passwordCharSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("password-charset", true);
    generatedPasswordCharacterSet.addLongIdentifier("password-char-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("pwCharSet", true);
    generatedPasswordCharacterSet.addLongIdentifier("pw-charset", true);
    generatedPasswordCharacterSet.addLongIdentifier("pw-char-set", true);
    generatedPasswordCharacterSet.addLongIdentifier("passwordChars", true);
    generatedPasswordCharacterSet.addLongIdentifier("password-chars", true);
    generatedPasswordCharacterSet.addLongIdentifier("pw-chars", true);
    generatedPasswordCharacterSet.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_NEW_PASSWORD.get());
    parser.addArgument(generatedPasswordCharacterSet);
    // Current password arguments.
    currentPassword = new StringArgument('c', "currentPassword", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_PASSWORD.get(), INFO_PWMOD_ARG_DESC_CURRENT_PASSWORD.get());
    currentPassword.addLongIdentifier("current-password", true);
    currentPassword.addLongIdentifier("currentPW", true);
    currentPassword.addLongIdentifier("current-pw", true);
    currentPassword.addLongIdentifier("current", true);
    currentPassword.addLongIdentifier("oldPassword", true);
    currentPassword.addLongIdentifier("old-password", true);
    currentPassword.addLongIdentifier("oldPW", true);
    currentPassword.addLongIdentifier("old-pw", true);
    currentPassword.addLongIdentifier("old", true);
    currentPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_CURRENT_PASSWORD.get());
    parser.addArgument(currentPassword);
    currentPasswordFile = new FileArgument('C', "currentPasswordFile", false, 1, null, INFO_PWMOD_ARG_DESC_CURRENT_PASSWORD_FILE.get(), true, true, true, false);
    currentPasswordFile.addLongIdentifier("current-password-file", true);
    currentPasswordFile.addLongIdentifier("currentPWFile", true);
    currentPasswordFile.addLongIdentifier("current-pw-file", true);
    currentPasswordFile.addLongIdentifier("currentFile", true);
    currentPasswordFile.addLongIdentifier("current-file", true);
    currentPasswordFile.addLongIdentifier("currentPasswordPath", true);
    currentPasswordFile.addLongIdentifier("current-password-path", true);
    currentPasswordFile.addLongIdentifier("currentPWPath", true);
    currentPasswordFile.addLongIdentifier("current-pw-path", true);
    currentPasswordFile.addLongIdentifier("currentPath", true);
    currentPasswordFile.addLongIdentifier("current-path", true);
    currentPasswordFile.addLongIdentifier("oldPasswordFile", true);
    currentPasswordFile.addLongIdentifier("old-password-file", true);
    currentPasswordFile.addLongIdentifier("oldPWFile", true);
    currentPasswordFile.addLongIdentifier("old-pw-file", true);
    currentPasswordFile.addLongIdentifier("oldFile", true);
    currentPasswordFile.addLongIdentifier("old-file", true);
    currentPasswordFile.addLongIdentifier("oldPasswordPath", true);
    currentPasswordFile.addLongIdentifier("old-password-path", true);
    currentPasswordFile.addLongIdentifier("oldPWPath", true);
    currentPasswordFile.addLongIdentifier("old-pw-path", true);
    currentPasswordFile.addLongIdentifier("oldPath", true);
    currentPasswordFile.addLongIdentifier("old-path", true);
    currentPasswordFile.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_CURRENT_PASSWORD.get());
    parser.addArgument(currentPasswordFile);
    promptForCurrentPassword = new BooleanArgument(null, "promptForCurrentPassword", 1, INFO_PWMOD_ARG_DESC_PROMPT_FOR_CURRENT_PASSWORD.get());
    promptForCurrentPassword.addLongIdentifier("prompt-for-current-password", true);
    promptForCurrentPassword.addLongIdentifier("promptForCurrentPW", true);
    promptForCurrentPassword.addLongIdentifier("prompt-for-current-pw", true);
    promptForCurrentPassword.addLongIdentifier("promptForCurrent", true);
    promptForCurrentPassword.addLongIdentifier("prompt-for-current", true);
    promptForCurrentPassword.addLongIdentifier("promptCurrent", true);
    promptForCurrentPassword.addLongIdentifier("prompt-current", true);
    promptForCurrentPassword.addLongIdentifier("promptForOldPassword", true);
    promptForCurrentPassword.addLongIdentifier("prompt-for-old-password", true);
    promptForCurrentPassword.addLongIdentifier("promptForOldPW", true);
    promptForCurrentPassword.addLongIdentifier("prompt-for-old-pw", true);
    promptForCurrentPassword.addLongIdentifier("promptForOld", true);
    promptForCurrentPassword.addLongIdentifier("prompt-for-old", true);
    promptForCurrentPassword.addLongIdentifier("promptOld", true);
    promptForCurrentPassword.addLongIdentifier("prompt-old", true);
    promptForCurrentPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_CURRENT_PASSWORD.get());
    parser.addArgument(promptForCurrentPassword);
    // Bind control arguments.
    bindControl = new ControlArgument(null, "bindControl", false, 0, null, INFO_PWMOD_ARG_DESC_BIND_CONTROL.get());
    bindControl.addLongIdentifier("bind-control", true);
    bindControl.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_BIND_CONTROL.get());
    parser.addArgument(bindControl);
    useAuthorizationIdentityControl = new BooleanArgument(null, "useAuthorizationIdentityControl", 1, INFO_PWMOD_ARG_DESC_USE_AUTHZ_ID_CONTROL.get());
    useAuthorizationIdentityControl.addLongIdentifier("use-authorization-identity-control", true);
    useAuthorizationIdentityControl.addLongIdentifier("useAuthorizationID-control", true);
    useAuthorizationIdentityControl.addLongIdentifier("use-authorization-id-control", true);
    useAuthorizationIdentityControl.addLongIdentifier("authorizationIdentityControl", true);
    useAuthorizationIdentityControl.addLongIdentifier("authorization-identity-control", true);
    useAuthorizationIdentityControl.addLongIdentifier("authorizationIDControl", true);
    useAuthorizationIdentityControl.addLongIdentifier("authorization-id-control", true);
    useAuthorizationIdentityControl.addLongIdentifier("authzIDControl", true);
    useAuthorizationIdentityControl.addLongIdentifier("authz-id-control", true);
    useAuthorizationIdentityControl.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_BIND_CONTROL.get());
    parser.addArgument(useAuthorizationIdentityControl);
    usePasswordPolicyControlOnBind = new BooleanArgument(null, "usePasswordPolicyControlOnBind", 1, INFO_PWMOD_ARG_DESC_USE_PW_POLICY_CONTROL_ON_BIND.get());
    usePasswordPolicyControlOnBind.addLongIdentifier("use-password-policy-control-on-bind", true);
    usePasswordPolicyControlOnBind.addLongIdentifier("usePWPolicyControlOnBind", true);
    usePasswordPolicyControlOnBind.addLongIdentifier("use-pw-policy-control-on-bind", true);
    usePasswordPolicyControlOnBind.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_BIND_CONTROL.get());
    parser.addArgument(usePasswordPolicyControlOnBind);
    getAuthorizationEntryAttribute = new StringArgument(null, "getAuthorizationEntryAttribute", false, 0, INFO_PWMOD_ARG_PLACEHOLDER_ATTRIBUTE_NAME.get(), INFO_PWMOD_ARG_DESC_GET_AUTHZ_ENTRY_ATTRIBUTE.get());
    getAuthorizationEntryAttribute.addLongIdentifier("get-authorization-entry-attribute", true);
    getAuthorizationEntryAttribute.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_BIND_CONTROL.get());
    parser.addArgument(getAuthorizationEntryAttribute);
    getUserResourceLimits = new BooleanArgument(null, "getUserResourceLimits", 1, INFO_PWMOD_ARG_DESC_GET_USER_RESOURCE_LIMITS.get());
    getUserResourceLimits.addLongIdentifier("get-user-resource-limits", true);
    getUserResourceLimits.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_BIND_CONTROL.get());
    parser.addArgument(getUserResourceLimits);
    // Update control arguments.
    updateControl = new ControlArgument('J', "updateControl", false, 0, null, INFO_PWMOD_ARG_DESC_UPDATE_CONTROL.get());
    updateControl.addLongIdentifier("update-control", true);
    updateControl.addLongIdentifier("control", true);
    updateControl.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(updateControl);
    usePasswordPolicyControlOnUpdate = new BooleanArgument(null, "usePasswordPolicyControlOnUpdate", 1, INFO_PWMOD_ARG_DESC_USE_PW_POLICY_CONTROL_ON_UPDATE.get());
    usePasswordPolicyControlOnUpdate.addLongIdentifier("use-password-policy-control-on-update", true);
    usePasswordPolicyControlOnUpdate.addLongIdentifier("usePWPolicyControlOnUpdate", true);
    usePasswordPolicyControlOnUpdate.addLongIdentifier("use-pw-policy-control-on-update", true);
    usePasswordPolicyControlOnUpdate.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(usePasswordPolicyControlOnUpdate);
    noOperation = new BooleanArgument(null, "noOperation", 1, INFO_PWMOD_ARG_DESC_NO_OPERATION.get());
    noOperation.addLongIdentifier("no-operation", true);
    noOperation.addLongIdentifier("noOp", true);
    noOperation.addLongIdentifier("no-op", true);
    noOperation.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(noOperation);
    getPasswordValidationDetails = new BooleanArgument(null, "getPasswordValidationDetails", 1, INFO_PWMOD_ARG_DESC_GET_PW_VALIDATION_DETAILS.get());
    getPasswordValidationDetails.addLongIdentifier("get-password-validation-details", true);
    getPasswordValidationDetails.addLongIdentifier("getPWValidationDetails", true);
    getPasswordValidationDetails.addLongIdentifier("get-pw-validation-details", true);
    getPasswordValidationDetails.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(getPasswordValidationDetails);
    retireCurrentPassword = new BooleanArgument(null, "retireCurrentPassword", 1, INFO_PWMOD_ARG_DESC_RETIRE_CURRENT_PASSWORD.get());
    retireCurrentPassword.addLongIdentifier("retire-current-password", true);
    retireCurrentPassword.addLongIdentifier("retireCurrentPW", true);
    retireCurrentPassword.addLongIdentifier("retire-current-pw", true);
    retireCurrentPassword.addLongIdentifier("retirePassword", true);
    retireCurrentPassword.addLongIdentifier("retire-password", true);
    retireCurrentPassword.addLongIdentifier("retirePW", true);
    retireCurrentPassword.addLongIdentifier("retire-pw", true);
    retireCurrentPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(retireCurrentPassword);
    purgeCurrentPassword = new BooleanArgument(null, "purgeCurrentPassword", 1, INFO_PWMOD_ARG_DESC_PURGE_CURRENT_PASSWORD.get());
    purgeCurrentPassword.addLongIdentifier("purge-current-password", true);
    purgeCurrentPassword.addLongIdentifier("purgeCurrentPW", true);
    purgeCurrentPassword.addLongIdentifier("purge-current-pw", true);
    purgeCurrentPassword.addLongIdentifier("purgePassword", true);
    purgeCurrentPassword.addLongIdentifier("purge-password", true);
    purgeCurrentPassword.addLongIdentifier("purgePW", true);
    purgeCurrentPassword.addLongIdentifier("purge-pw", true);
    purgeCurrentPassword.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(purgeCurrentPassword);
    passwordUpdateBehavior = new StringArgument(null, "passwordUpdateBehavior", false, 0, INFO_PWMOD_ARG_PLACEHOLDER_NAME_VALUE.get(), INFO_PWMOD_ARG_DESC_PASSWORD_UPDATE_BEHAVIOR.get());
    passwordUpdateBehavior.addLongIdentifier("password-update-behavior", true);
    passwordUpdateBehavior.addLongIdentifier("pwUpdateBehavior", true);
    passwordUpdateBehavior.addLongIdentifier("pw-update-behavior", true);
    passwordUpdateBehavior.addLongIdentifier("updateBehavior", true);
    passwordUpdateBehavior.addLongIdentifier("update-behavior", true);
    passwordUpdateBehavior.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(passwordUpdateBehavior);
    useAssuredReplication = new BooleanArgument(null, "useAssuredReplication", 1, INFO_PWMOD_ARG_DESC_ASSURED_REPLICATION.get());
    useAssuredReplication.addLongIdentifier("use-assured-replication", true);
    useAssuredReplication.addLongIdentifier("assuredReplication", true);
    useAssuredReplication.addLongIdentifier("assured-replication", true);
    useAssuredReplication.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(useAssuredReplication);
    assuredReplicationLocalLevel = new StringArgument(null, "assuredReplicationLocalLevel", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_LEVEL.get(), INFO_PWMOD_ARG_DESC_ASSURED_REPLICATION_LOCAL_LEVEL.get(), StaticUtils.setOf(ASSURED_REPLICATION_LOCAL_LEVEL_NONE, ASSURED_REPLICATION_LOCAL_LEVEL_RECEIVED_ANY_SERVER, ASSURED_REPLICATION_LOCAL_LEVEL_PROCESSED_ALL_SERVERS));
    assuredReplicationLocalLevel.addLongIdentifier("assured-replication-local-level", true);
    assuredReplicationLocalLevel.addLongIdentifier("localLevel", true);
    assuredReplicationLocalLevel.addLongIdentifier("local-level", true);
    assuredReplicationLocalLevel.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(assuredReplicationLocalLevel);
    assuredReplicationRemoteLevel = new StringArgument(null, "assuredReplicationRemoteLevel", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_LEVEL.get(), INFO_PWMOD_ARG_DESC_ASSURED_REPLICATION_REMOTE_LEVEL.get(), StaticUtils.setOf(ASSURED_REPLICATION_REMOTE_LEVEL_NONE, ASSURED_REPLICATION_REMOTE_LEVEL_RECEIVED_ANY_REMOTE_LOCATION, ASSURED_REPLICATION_REMOTE_LEVEL_RECEIVED_ALL_REMOTE_LOCATIONS, ASSURED_REPLICATION_REMOTE_LEVEL_PROCESSED_ALL_REMOTE_SERVERS));
    assuredReplicationRemoteLevel.addLongIdentifier("assured-replication-remote-level", true);
    assuredReplicationRemoteLevel.addLongIdentifier("remoteLevel", true);
    assuredReplicationRemoteLevel.addLongIdentifier("remote-level", true);
    assuredReplicationRemoteLevel.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(assuredReplicationRemoteLevel);
    assuredReplicationTimeout = new DurationArgument(null, "assuredReplicationTimeout", false, INFO_PWMOD_ARG_PLACEHOLDER_TIMEOUT.get(), INFO_PWMOD_ARG_DESC_ASSURED_REPLICATION_TIMEOUT.get());
    assuredReplicationTimeout.addLongIdentifier("assured-replication-timeout", true);
    assuredReplicationTimeout.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(assuredReplicationTimeout);
    operationPurpose = new StringArgument(null, "operationPurpose", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_PURPOSE.get(), INFO_PWMOD_ARG_DESC_OPERATION_PURPOSE.get());
    operationPurpose.addLongIdentifier("operation-purpose", true);
    operationPurpose.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_UPDATE_CONTROL.get());
    parser.addArgument(operationPurpose);
    // Other arguments
    passwordAttribute = new StringArgument(null, "passwordAttribute", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_ATTRIBUTE_NAME.get(), INFO_PWMOD_ARG_DESC_PASSWORD_ATTRIBUTE.get(), DEFAULT_PASSWORD_ATTRIBUTE);
    passwordAttribute.addLongIdentifier("password-attribute", true);
    passwordAttribute.addLongIdentifier("passwordAttr", true);
    passwordAttribute.addLongIdentifier("password-attr", true);
    passwordAttribute.addLongIdentifier("pwAttribute", true);
    passwordAttribute.addLongIdentifier("pw-attribute", true);
    passwordAttribute.addLongIdentifier("pwAttr", true);
    passwordAttribute.addLongIdentifier("pw-attr", true);
    passwordAttribute.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    passwordChangeMethod = new StringArgument(null, "passwordChangeMethod", false, 1, INFO_PWMOD_ARG_PLACEHOLDER_CHANGE_METHOD.get(), INFO_PWMOD_ARG_DESC_PASSWORD_CHANGE_METHOD.get(), StaticUtils.setOf(PASSWORD_CHANGE_METHOD_PW_MOD_EXTOP, PASSWORD_CHANGE_METHOD_LDAP_MOD, PASSWORD_CHANGE_METHOD_AD));
    passwordChangeMethod.addLongIdentifier("password-change-method", true);
    passwordChangeMethod.addLongIdentifier("pwChangeMethod", true);
    passwordChangeMethod.addLongIdentifier("pw-change-method", true);
    passwordChangeMethod.addLongIdentifier("changeMethod", true);
    passwordChangeMethod.addLongIdentifier("change-method", true);
    passwordChangeMethod.addLongIdentifier("method", true);
    passwordChangeMethod.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    parser.addArgument(passwordChangeMethod);
    followReferrals = new BooleanArgument(null, "followReferrals", 1, INFO_PWMOD_ARG_DESC_FOLLOW_REFERRALS.get());
    followReferrals.addLongIdentifier("follow-referrals", true);
    followReferrals.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    parser.addArgument(followReferrals);
    useAdministrativeSession = new BooleanArgument(null, "useAdministrativeSession", 1, INFO_PWMOD_ARG_DESC_USE_ADMIN_SESSION.get());
    useAdministrativeSession.addLongIdentifier("use-administrative-session", true);
    useAdministrativeSession.addLongIdentifier("useAdminSession", true);
    useAdministrativeSession.addLongIdentifier("use-admin-session", true);
    useAdministrativeSession.addLongIdentifier("administrativeSession", true);
    useAdministrativeSession.addLongIdentifier("administrative-session", true);
    useAdministrativeSession.addLongIdentifier("adminSession", true);
    useAdministrativeSession.addLongIdentifier("admin-session", true);
    useAdministrativeSession.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    parser.addArgument(useAdministrativeSession);
    verbose = new BooleanArgument('v', "verbose", 1, INFO_PWMOD_ARG_DESC_VERBOSE.get());
    verbose.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    parser.addArgument(verbose);
    // This argument isn't actually used, but provides command-line backward
    // compatibility with an existing implementation.
    scriptFriendly = new BooleanArgument(null, "script-friendly", 1, INFO_PWMOD_ARG_DESC_SCRIPT_FRIENDLY.get());
    scriptFriendly.setArgumentGroupName(INFO_PWMOD_ARG_GROUP_OTHER.get());
    scriptFriendly.setHidden(true);
    parser.addArgument(scriptFriendly);
    // Argument constraints.
    parser.addExclusiveArgumentSet(userIdentity, provideBindDNAsUserIdentity);
    final DNArgument bindDNArgument = parser.getDNArgument(BIND_DN_ARGUMENT_LONG_IDENTIFIER);
    parser.addDependentArgumentSet(provideBindDNAsUserIdentity, bindDNArgument);
    parser.addExclusiveArgumentSet(newPassword, newPasswordFile, promptForNewPassword, generateClientSideNewPassword);
    parser.addDependentArgumentSet(generatedPasswordLength, generateClientSideNewPassword);
    parser.addDependentArgumentSet(generatedPasswordCharacterSet, generateClientSideNewPassword);
    parser.addExclusiveArgumentSet(currentPassword, currentPasswordFile, promptForCurrentPassword);
    parser.addDependentArgumentSet(assuredReplicationLocalLevel, useAssuredReplication);
    parser.addDependentArgumentSet(assuredReplicationRemoteLevel, useAssuredReplication);
    parser.addDependentArgumentSet(assuredReplicationTimeout, useAssuredReplication);
    parser.addExclusiveArgumentSet(retireCurrentPassword, purgeCurrentPassword);
}
Also used : ControlArgument(com.unboundid.util.args.ControlArgument) DNArgument(com.unboundid.util.args.DNArgument) DurationArgument(com.unboundid.util.args.DurationArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Example 4 with DNArgument

use of com.unboundid.util.args.DNArgument in project ldapsdk by pingidentity.

the class ManageAccount method doToolProcessing.

/**
 * {@inheritDoc}
 */
@Override()
@NotNull()
public ResultCode doToolProcessing() {
    // If we should just generate a sample rate data file, then do that now.
    final FileArgument generateSampleRateFile = parser.getFileArgument(ARG_GENERATE_SAMPLE_RATE_FILE);
    if (generateSampleRateFile.isPresent()) {
        try {
            RateAdjustor.writeSampleVariableRateFile(generateSampleRateFile.getValue());
            return ResultCode.SUCCESS;
        } catch (final Exception e) {
            Debug.debugException(e);
            wrapErr(0, WRAP_COLUMN, ERR_MANAGE_ACCT_CANNOT_GENERATE_SAMPLE_RATE_FILE.get(generateSampleRateFile.getValue().getAbsolutePath(), StaticUtils.getExceptionMessage(e)));
            return ResultCode.LOCAL_ERROR;
        }
    }
    // If we need to create a fixed-rate barrier and/or use a variable rate
    // definition, then set that up.
    final IntegerArgument ratePerSecond = parser.getIntegerArgument(ARG_RATE_PER_SECOND);
    final FileArgument variableRateData = parser.getFileArgument(ARG_VARIABLE_RATE_DATA);
    if (ratePerSecond.isPresent() || variableRateData.isPresent()) {
        if (ratePerSecond.isPresent()) {
            rateLimiter = new FixedRateBarrier(1000L, ratePerSecond.getValue());
        } else {
            rateLimiter = new FixedRateBarrier(1000L, Integer.MAX_VALUE);
        }
        if (variableRateData.isPresent()) {
            try {
                rateAdjustor = RateAdjustor.newInstance(rateLimiter, ratePerSecond.getValue(), variableRateData.getValue());
            } catch (final Exception e) {
                Debug.debugException(e);
                wrapErr(0, WRAP_COLUMN, ERR_MANAGE_ACCT_CANNOT_CREATE_RATE_ADJUSTOR.get(variableRateData.getValue().getAbsolutePath(), StaticUtils.getExceptionMessage(e)));
                return ResultCode.PARAM_ERROR;
            }
        }
    }
    // Create the connection pool to use for all processing.
    final LDAPConnectionPool pool;
    final int numSearchThreads = parser.getIntegerArgument(ARG_NUM_SEARCH_THREADS).getValue();
    try {
        final int numOperationThreads = parser.getIntegerArgument(ARG_NUM_THREADS).getValue();
        pool = getConnectionPool(numOperationThreads, (numOperationThreads + numSearchThreads));
        // Explicitly disable automatic retry, since it probably won't work
        // reliably for extended operations anyway.  We'll handle retry manually.
        pool.setRetryFailedOperationsDueToInvalidConnections(false);
        // Set a maximum connection age of 30 minutes.
        pool.setMaxConnectionAgeMillis(1_800_000L);
    } catch (final LDAPException le) {
        Debug.debugException(le);
        wrapErr(0, WRAP_COLUMN, ERR_MANAGE_ACCT_CANNOT_CREATE_CONNECTION_POOL.get(getToolName(), le.getMessage()));
        return le.getResultCode();
    }
    try {
        // Create the output writer.  This should always succeed.
        outputWriter = new LDIFWriter(getOut());
        // Create the reject writer if appropriate.
        final FileArgument rejectFile = parser.getFileArgument(ARG_REJECT_FILE);
        if (rejectFile.isPresent()) {
            final BooleanArgument appendToRejectFile = parser.getBooleanArgument(ARG_APPEND_TO_REJECT_FILE);
            try {
                rejectWriter = new LDIFWriter(new FileOutputStream(rejectFile.getValue(), appendToRejectFile.isPresent()));
            } catch (final Exception e) {
                Debug.debugException(e);
                wrapErr(0, WRAP_COLUMN, ERR_MANAGE_ACCT_CANNOT_CREATE_REJECT_WRITER.get(rejectFile.getValue().getAbsolutePath(), StaticUtils.getExceptionMessage(e)));
                return ResultCode.LOCAL_ERROR;
            }
        }
        // Create the processor that will be used to actually perform the
        // manage-account operation processing for each entry.
        final ManageAccountProcessor processor;
        try {
            processor = new ManageAccountProcessor(this, pool, rateLimiter, outputWriter, rejectWriter);
        } catch (final LDAPException le) {
            Debug.debugException(le);
            wrapErr(0, WRAP_COLUMN, ERR_MANAGE_ACCT_CANNOT_CREATE_PROCESSOR.get(StaticUtils.getExceptionMessage(le)));
            return le.getResultCode();
        }
        // If we should use a rate adjustor, then start it now.
        if (rateAdjustor != null) {
            rateAdjustor.start();
        }
        // If any targetDN values were provided, then process them now.
        final DNArgument targetDN = parser.getDNArgument(ARG_TARGET_DN);
        if (targetDN.isPresent()) {
            for (final DN dn : targetDN.getValues()) {
                if (cancelRequested()) {
                    return ResultCode.USER_CANCELED;
                }
                processor.process(dn.toString());
            }
        }
        // If any DN input files were specified, then process them now.
        final FileArgument dnInputFile = parser.getFileArgument(ARG_DN_INPUT_FILE);
        if (dnInputFile.isPresent()) {
            for (final File f : dnInputFile.getValues()) {
                DNFileReader reader = null;
                try {
                    reader = new DNFileReader(f);
                    while (true) {
                        if (cancelRequested()) {
                            return ResultCode.USER_CANCELED;
                        }
                        final DN dn;
                        try {
                            dn = reader.readDN();
                        } catch (final LDAPException le) {
                            Debug.debugException(le);
                            processor.handleMessage(le.getMessage(), true);
                            continue;
                        }
                        if (dn == null) {
                            break;
                        }
                        processor.process(dn.toString());
                    }
                } catch (final Exception e) {
                    Debug.debugException(e);
                    processor.handleMessage(ERR_MANAGE_ACCT_ERROR_READING_DN_FILE.get(f.getAbsolutePath(), StaticUtils.getExceptionMessage(e)), true);
                } finally {
                    if (reader != null) {
                        try {
                            reader.close();
                        } catch (final Exception e2) {
                            Debug.debugException(e2);
                        }
                    }
                }
            }
        }
        // If any target filters were specified, then process them now.
        final FilterArgument targetFilter = parser.getFilterArgument(ARG_TARGET_FILTER);
        if (targetFilter.isPresent()) {
            searchProcessor = new ManageAccountSearchProcessor(this, processor, pool);
            for (final Filter f : targetFilter.getValues()) {
                searchProcessor.processFilter(f);
            }
        }
        // If any filter input files were specified, then process them now.
        final FileArgument filterInputFile = parser.getFileArgument(ARG_FILTER_INPUT_FILE);
        if (filterInputFile.isPresent()) {
            if (searchProcessor == null) {
                searchProcessor = new ManageAccountSearchProcessor(this, processor, pool);
            }
            for (final File f : filterInputFile.getValues()) {
                FilterFileReader reader = null;
                try {
                    reader = new FilterFileReader(f);
                    while (true) {
                        if (cancelRequested()) {
                            return ResultCode.USER_CANCELED;
                        }
                        final Filter filter;
                        try {
                            filter = reader.readFilter();
                        } catch (final LDAPException le) {
                            Debug.debugException(le);
                            processor.handleMessage(le.getMessage(), true);
                            continue;
                        }
                        if (filter == null) {
                            break;
                        }
                        searchProcessor.processFilter(filter);
                    }
                } catch (final Exception e) {
                    Debug.debugException(e);
                    processor.handleMessage(ERR_MANAGE_ACCT_ERROR_READING_FILTER_FILE.get(f.getAbsolutePath(), StaticUtils.getExceptionMessage(e)), true);
                } finally {
                    if (reader != null) {
                        try {
                            reader.close();
                        } catch (final Exception e2) {
                            Debug.debugException(e2);
                        }
                    }
                }
            }
        }
        // If any target user IDs were specified, then process them now.
        final StringArgument targetUserID = parser.getStringArgument(ARG_TARGET_USER_ID);
        if (targetUserID.isPresent()) {
            if (searchProcessor == null) {
                searchProcessor = new ManageAccountSearchProcessor(this, processor, pool);
            }
            for (final String userID : targetUserID.getValues()) {
                searchProcessor.processUserID(userID);
            }
        }
        // If any user ID input files were specified, then process them now.
        final FileArgument userIDInputFile = parser.getFileArgument(ARG_USER_ID_INPUT_FILE);
        if (userIDInputFile.isPresent()) {
            if (searchProcessor == null) {
                searchProcessor = new ManageAccountSearchProcessor(this, processor, pool);
            }
            for (final File f : userIDInputFile.getValues()) {
                BufferedReader reader = null;
                try {
                    reader = new BufferedReader(new FileReader(f));
                    while (true) {
                        if (cancelRequested()) {
                            return ResultCode.USER_CANCELED;
                        }
                        final String line = reader.readLine();
                        if (line == null) {
                            break;
                        }
                        if ((line.length() == 0) || line.startsWith("#")) {
                            continue;
                        }
                        searchProcessor.processUserID(line.trim());
                    }
                } catch (final Exception e) {
                    Debug.debugException(e);
                    processor.handleMessage(ERR_MANAGE_ACCT_ERROR_READING_USER_ID_FILE.get(f.getAbsolutePath(), StaticUtils.getExceptionMessage(e)), true);
                } finally {
                    if (reader != null) {
                        try {
                            reader.close();
                        } catch (final Exception e2) {
                            Debug.debugException(e2);
                        }
                    }
                }
            }
        }
        allFiltersProvided.set(true);
        if (searchProcessor != null) {
            searchProcessor.waitForCompletion();
        }
        allDNsProvided.set(true);
        processor.waitForCompletion();
    } finally {
        pool.close();
        if (rejectWriter != null) {
            try {
                rejectWriter.close();
            } catch (final Exception e) {
                Debug.debugException(e);
            }
        }
    }
    // if some of the operations failed.
    return ResultCode.SUCCESS;
}
Also used : LDAPConnectionPool(com.unboundid.ldap.sdk.LDAPConnectionPool) BooleanArgument(com.unboundid.util.args.BooleanArgument) DN(com.unboundid.ldap.sdk.DN) DNFileReader(com.unboundid.util.DNFileReader) FileArgument(com.unboundid.util.args.FileArgument) ArgumentException(com.unboundid.util.args.ArgumentException) LDAPException(com.unboundid.ldap.sdk.LDAPException) StringArgument(com.unboundid.util.args.StringArgument) DNArgument(com.unboundid.util.args.DNArgument) FilterFileReader(com.unboundid.util.FilterFileReader) LDAPException(com.unboundid.ldap.sdk.LDAPException) Filter(com.unboundid.ldap.sdk.Filter) FileOutputStream(java.io.FileOutputStream) FilterArgument(com.unboundid.util.args.FilterArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) BufferedReader(java.io.BufferedReader) FixedRateBarrier(com.unboundid.util.FixedRateBarrier) LDIFWriter(com.unboundid.ldif.LDIFWriter) DNFileReader(com.unboundid.util.DNFileReader) FilterFileReader(com.unboundid.util.FilterFileReader) FileReader(java.io.FileReader) File(java.io.File) NotNull(com.unboundid.util.NotNull)

Example 5 with DNArgument

use of com.unboundid.util.args.DNArgument in project ldapsdk by pingidentity.

the class LDAPSearch method addNonLDAPArguments.

/**
 * Adds the arguments used by this program that aren't already provided by the
 * generic {@code LDAPCommandLineTool} framework.
 *
 * @param  parser  The argument parser to which the arguments should be added.
 *
 * @throws  ArgumentException  If a problem occurs while adding the arguments.
 */
@Override()
public void addNonLDAPArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    this.parser = parser;
    String description = "The base DN to use for the search.  This must be " + "provided.";
    baseDN = new DNArgument('b', "baseDN", true, 1, "{dn}", description);
    baseDN.addLongIdentifier("base-dn", true);
    parser.addArgument(baseDN);
    description = "The scope to use for the search.  It should be 'base', " + "'one', 'sub', or 'subord'.  If this is not provided, then " + "a default scope of 'sub' will be used.";
    scopeArg = new ScopeArgument('s', "scope", false, "{scope}", description, SearchScope.SUB);
    parser.addArgument(scopeArg);
    description = "Follow any referrals encountered during processing.";
    followReferrals = new BooleanArgument('R', "followReferrals", description);
    followReferrals.addLongIdentifier("follow-referrals", true);
    parser.addArgument(followReferrals);
    description = "Information about a control to include in the bind request.";
    bindControls = new ControlArgument(null, "bindControl", false, 0, null, description);
    bindControls.addLongIdentifier("bind-control", true);
    parser.addArgument(bindControls);
    description = "Information about a control to include in search requests.";
    searchControls = new ControlArgument('J', "control", false, 0, null, description);
    parser.addArgument(searchControls);
    description = "Generate terse output with minimal additional information.";
    terseMode = new BooleanArgument('t', "terse", description);
    parser.addArgument(terseMode);
    description = "Specifies the length of time in milliseconds to sleep " + "before repeating the same search.  If this is not " + "provided, then the search will only be performed once.";
    repeatIntervalMillis = new IntegerArgument('i', "repeatIntervalMillis", false, 1, "{millis}", description, 0, Integer.MAX_VALUE);
    repeatIntervalMillis.addLongIdentifier("repeat-interval-millis", true);
    parser.addArgument(repeatIntervalMillis);
    description = "Specifies the number of times that the search should be " + "performed.  If this argument is present, then the " + "--repeatIntervalMillis argument must also be provided to " + "specify the length of time between searches.  If " + "--repeatIntervalMillis is used without --numSearches, " + "then the search will be repeated until the tool is " + "interrupted.";
    numSearches = new IntegerArgument('n', "numSearches", false, 1, "{count}", description, 1, Integer.MAX_VALUE);
    numSearches.addLongIdentifier("num-searches", true);
    parser.addArgument(numSearches);
    parser.addDependentArgumentSet(numSearches, repeatIntervalMillis);
}
Also used : ControlArgument(com.unboundid.util.args.ControlArgument) DNArgument(com.unboundid.util.args.DNArgument) ScopeArgument(com.unboundid.util.args.ScopeArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument)

Aggregations

DNArgument (com.unboundid.util.args.DNArgument)31 StringArgument (com.unboundid.util.args.StringArgument)28 BooleanArgument (com.unboundid.util.args.BooleanArgument)25 FileArgument (com.unboundid.util.args.FileArgument)24 IntegerArgument (com.unboundid.util.args.IntegerArgument)23 FilterArgument (com.unboundid.util.args.FilterArgument)11 ControlArgument (com.unboundid.util.args.ControlArgument)8 ScopeArgument (com.unboundid.util.args.ScopeArgument)6 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)5 DN (com.unboundid.ldap.sdk.DN)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)5 BooleanValueArgument (com.unboundid.util.args.BooleanValueArgument)5 DurationArgument (com.unboundid.util.args.DurationArgument)5 ArgumentException (com.unboundid.util.args.ArgumentException)4 ArgumentParser (com.unboundid.util.args.ArgumentParser)4 TimestampArgument (com.unboundid.util.args.TimestampArgument)4 NotNull (com.unboundid.util.NotNull)3 SubCommand (com.unboundid.util.args.SubCommand)3 File (java.io.File)3 ASN1BitString (com.unboundid.asn1.ASN1BitString)2