use of com.unboundid.util.args.FilterArgument 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);
}
use of com.unboundid.util.args.FilterArgument 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;
}
use of com.unboundid.util.args.FilterArgument in project ldapsdk by pingidentity.
the class SearchAndModRate 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 {
String description = "The base DN to use for the searches. It may be a " + "simple DN or a value pattern to specify a range of DNs (e.g., " + "\"uid=user.[1-1000],ou=People,dc=example,dc=com\"). See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the " + "value pattern syntax. This must be provided.";
baseDN = new StringArgument('b', "baseDN", true, 1, "{dn}", description);
baseDN.setArgumentGroupName("Search And Modification Arguments");
baseDN.addLongIdentifier("base-dn", true);
parser.addArgument(baseDN);
description = "The scope to use for the searches. 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);
scopeArg.setArgumentGroupName("Search And Modification Arguments");
parser.addArgument(scopeArg);
description = "The filter to use for the searches. It may be a simple " + "filter or a value pattern to specify a range of filters " + "(e.g., \"(uid=user.[1-1000])\"). See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details " + "about the value pattern syntax. This must be provided.";
filter = new StringArgument('f', "filter", true, 1, "{filter}", description);
filter.setArgumentGroupName("Search And Modification Arguments");
parser.addArgument(filter);
description = "The name of an attribute to include in entries returned " + "from the searches. Multiple attributes may be requested " + "by providing this argument multiple times. If no request " + "attributes are provided, then the entries returned will " + "include all user attributes.";
returnAttributes = new StringArgument('A', "attribute", false, 0, "{name}", description);
returnAttributes.setArgumentGroupName("Search And Modification Arguments");
parser.addArgument(returnAttributes);
description = "The name of the attribute to modify. Multiple attributes " + "may be specified by providing this argument multiple " + "times. At least one attribute must be specified.";
modifyAttributes = new StringArgument('m', "modifyAttribute", true, 0, "{name}", description);
modifyAttributes.setArgumentGroupName("Search And Modification Arguments");
modifyAttributes.addLongIdentifier("modify-attribute", true);
parser.addArgument(modifyAttributes);
description = "The length in bytes to use when generating values for the " + "modifications. If this is not provided, then a default " + "length of ten bytes will be used.";
valueLength = new IntegerArgument('l', "valueLength", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 10);
valueLength.setArgumentGroupName("Search And Modification Arguments");
valueLength.addLongIdentifier("value-length", true);
parser.addArgument(valueLength);
description = "The set of characters to use to generate the values for " + "the modifications. It should only include ASCII " + "characters. If this is not provided, then a default set " + "of lowercase alphabetic characters will be used.";
characterSet = new StringArgument('C', "characterSet", true, 1, "{chars}", description, "abcdefghijklmnopqrstuvwxyz");
characterSet.setArgumentGroupName("Search And Modification Arguments");
characterSet.addLongIdentifier("character-set", true);
parser.addArgument(characterSet);
description = "Indicates that search requests should include the " + "assertion request control with the specified filter.";
searchAssertionFilter = new FilterArgument(null, "searchAssertionFilter", false, 1, "{filter}", description);
searchAssertionFilter.setArgumentGroupName("Request Control Arguments");
searchAssertionFilter.addLongIdentifier("search-assertion-filter", true);
parser.addArgument(searchAssertionFilter);
description = "Indicates that modify requests should include the " + "assertion request control with the specified filter.";
modifyAssertionFilter = new FilterArgument(null, "modifyAssertionFilter", false, 1, "{filter}", description);
modifyAssertionFilter.setArgumentGroupName("Request Control Arguments");
modifyAssertionFilter.addLongIdentifier("modify-assertion-filter", true);
parser.addArgument(modifyAssertionFilter);
description = "Indicates that search requests should include the simple " + "paged results control with the specified page size.";
simplePageSize = new IntegerArgument(null, "simplePageSize", false, 1, "{size}", description, 1, Integer.MAX_VALUE);
simplePageSize.setArgumentGroupName("Request Control Arguments");
simplePageSize.addLongIdentifier("simple-page-size", true);
parser.addArgument(simplePageSize);
description = "Indicates that modify requests should include the " + "permissive modify request control.";
permissiveModify = new BooleanArgument(null, "permissiveModify", 1, description);
permissiveModify.setArgumentGroupName("Request Control Arguments");
permissiveModify.addLongIdentifier("permissive-modify", true);
parser.addArgument(permissiveModify);
description = "Indicates that modify requests should include the " + "pre-read request control with the specified requested " + "attribute. This argument may be provided multiple times " + "to indicate that multiple requested attributes should be " + "included in the pre-read request control.";
preReadAttribute = new StringArgument(null, "preReadAttribute", false, 0, "{attribute}", description);
preReadAttribute.setArgumentGroupName("Request Control Arguments");
preReadAttribute.addLongIdentifier("pre-read-attribute", true);
parser.addArgument(preReadAttribute);
description = "Indicates that modify requests should include the " + "post-read request control with the specified requested " + "attribute. This argument may be provided multiple times " + "to indicate that multiple requested attributes should be " + "included in the post-read request control.";
postReadAttribute = new StringArgument(null, "postReadAttribute", false, 0, "{attribute}", description);
postReadAttribute.setArgumentGroupName("Request Control Arguments");
postReadAttribute.addLongIdentifier("post-read-attribute", true);
parser.addArgument(postReadAttribute);
description = "Indicates that the proxied authorization control (as " + "defined in RFC 4370) should be used to request that " + "operations be processed using an alternate authorization " + "identity. This may be a simple authorization ID or it " + "may be a value pattern to specify a range of " + "identities. See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the value pattern syntax.";
proxyAs = new StringArgument('Y', "proxyAs", false, 1, "{authzID}", description);
proxyAs.setArgumentGroupName("Request Control Arguments");
proxyAs.addLongIdentifier("proxy-as", true);
parser.addArgument(proxyAs);
description = "Indicates that search requests should include the " + "specified request control. This may be provided multiple " + "times to include multiple search request controls.";
searchControl = new ControlArgument(null, "searchControl", false, 0, null, description);
searchControl.setArgumentGroupName("Request Control Arguments");
searchControl.addLongIdentifier("search-control", true);
parser.addArgument(searchControl);
description = "Indicates that modify requests should include the " + "specified request control. This may be provided multiple " + "times to include multiple modify request controls.";
modifyControl = new ControlArgument(null, "modifyControl", false, 0, null, description);
modifyControl.setArgumentGroupName("Request Control Arguments");
modifyControl.addLongIdentifier("modify-control", true);
parser.addArgument(modifyControl);
description = "The number of threads to use to perform the searches. If " + "this is not provided, then a default of one thread will " + "be used.";
numThreads = new IntegerArgument('t', "numThreads", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 1);
numThreads.setArgumentGroupName("Rate Management Arguments");
numThreads.addLongIdentifier("num-threads", true);
parser.addArgument(numThreads);
description = "The length of time in seconds between output lines. If " + "this is not provided, then a default interval of five " + "seconds will be used.";
collectionInterval = new IntegerArgument('i', "intervalDuration", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 5);
collectionInterval.setArgumentGroupName("Rate Management Arguments");
collectionInterval.addLongIdentifier("interval-duration", true);
parser.addArgument(collectionInterval);
description = "The maximum number of intervals for which to run. If " + "this is not provided, then the tool will run until it is " + "interrupted.";
numIntervals = new IntegerArgument('I', "numIntervals", true, 1, "{num}", description, 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
numIntervals.setArgumentGroupName("Rate Management Arguments");
numIntervals.addLongIdentifier("num-intervals", true);
parser.addArgument(numIntervals);
description = "The number of search and modify iterations that should be " + "processed on a connection before that connection is " + "closed and replaced with a newly-established (and " + "authenticated, if appropriate) connection. If this is " + "not provided, then connections will not be periodically " + "closed and re-established.";
iterationsBeforeReconnect = new IntegerArgument(null, "iterationsBeforeReconnect", false, 1, "{num}", description, 0);
iterationsBeforeReconnect.setArgumentGroupName("Rate Management Arguments");
iterationsBeforeReconnect.addLongIdentifier("iterations-before-reconnect", true);
parser.addArgument(iterationsBeforeReconnect);
description = "The target number of searches to perform per second. It " + "is still necessary to specify a sufficient number of " + "threads for achieving this rate. If neither this option " + "nor --variableRateData is provided, then the tool will " + "run at the maximum rate for the specified number of " + "threads.";
ratePerSecond = new IntegerArgument('r', "ratePerSecond", false, 1, "{searches-per-second}", description, 1, Integer.MAX_VALUE);
ratePerSecond.setArgumentGroupName("Rate Management Arguments");
ratePerSecond.addLongIdentifier("rate-per-second", true);
parser.addArgument(ratePerSecond);
final String variableRateDataArgName = "variableRateData";
final String generateSampleRateFileArgName = "generateSampleRateFile";
description = RateAdjustor.getVariableRateDataArgumentDescription(generateSampleRateFileArgName);
variableRateData = new FileArgument(null, variableRateDataArgName, false, 1, "{path}", description, true, true, true, false);
variableRateData.setArgumentGroupName("Rate Management Arguments");
variableRateData.addLongIdentifier("variable-rate-data", true);
parser.addArgument(variableRateData);
description = RateAdjustor.getGenerateSampleVariableRateFileDescription(variableRateDataArgName);
sampleRateFile = new FileArgument(null, generateSampleRateFileArgName, false, 1, "{path}", description, false, true, true, false);
sampleRateFile.setArgumentGroupName("Rate Management Arguments");
sampleRateFile.addLongIdentifier("generate-sample-rate-file", true);
sampleRateFile.setUsageArgument(true);
parser.addArgument(sampleRateFile);
parser.addExclusiveArgumentSet(variableRateData, sampleRateFile);
description = "The number of intervals to complete before beginning " + "overall statistics collection. Specifying a nonzero " + "number of warm-up intervals gives the client and server " + "a chance to warm up without skewing performance results.";
warmUpIntervals = new IntegerArgument(null, "warmUpIntervals", true, 1, "{num}", description, 0, Integer.MAX_VALUE, 0);
warmUpIntervals.setArgumentGroupName("Rate Management Arguments");
warmUpIntervals.addLongIdentifier("warm-up-intervals", true);
parser.addArgument(warmUpIntervals);
description = "Indicates the format to use for timestamps included in " + "the output. A value of 'none' indicates that no " + "timestamps should be included. A value of 'with-date' " + "indicates that both the date and the time should be " + "included. A value of 'without-date' indicates that only " + "the time should be included.";
final Set<String> allowedFormats = StaticUtils.setOf("none", "with-date", "without-date");
timestampFormat = new StringArgument(null, "timestampFormat", true, 1, "{format}", description, allowedFormats, "none");
timestampFormat.addLongIdentifier("timestamp-format", true);
parser.addArgument(timestampFormat);
description = "Indicates that information about the result codes for " + "failed operations should not be displayed.";
suppressErrors = new BooleanArgument(null, "suppressErrorResultCodes", 1, description);
suppressErrors.addLongIdentifier("suppress-error-result-codes", true);
parser.addArgument(suppressErrors);
description = "Generate output in CSV format rather than a " + "display-friendly format";
csvFormat = new BooleanArgument('c', "csv", 1, description);
parser.addArgument(csvFormat);
description = "Specifies the seed to use for the random number generator.";
randomSeed = new IntegerArgument('R', "randomSeed", false, 1, "{value}", description);
randomSeed.addLongIdentifier("random-seed", true);
parser.addArgument(randomSeed);
}
use of com.unboundid.util.args.FilterArgument in project ldapsdk by pingidentity.
the class SearchRate 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 {
String description = "The base DN to use for the searches. It may be a " + "simple DN or a value pattern to specify a range of DNs (e.g., " + "\"uid=user.[1-1000],ou=People,dc=example,dc=com\"). See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the " + "value pattern syntax. This argument must not be used in " + "conjunction with the --ldapURL argument.";
baseDN = new StringArgument('b', "baseDN", false, 1, "{dn}", description, "");
baseDN.setArgumentGroupName("Search Arguments");
baseDN.addLongIdentifier("base-dn", true);
parser.addArgument(baseDN);
description = "The scope to use for the searches. It should be 'base', " + "'one', 'sub', or 'subord'. If this is not provided, then a " + "default scope of 'sub' will be used. This argument must not be " + "used in conjunction with the --ldapURL argument.";
scope = new ScopeArgument('s', "scope", false, "{scope}", description, SearchScope.SUB);
scope.setArgumentGroupName("Search Arguments");
parser.addArgument(scope);
description = "The filter to use for the searches. It may be a simple " + "filter or a value pattern to specify a range of filters (e.g., " + "\"(uid=user.[1-1000])\"). See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the value pattern syntax. Exactly one " + "of this argument and the --ldapURL arguments must be provided.";
filter = new StringArgument('f', "filter", false, 1, "{filter}", description);
filter.setArgumentGroupName("Search Arguments");
parser.addArgument(filter);
description = "The name of an attribute to include in entries returned " + "from the searches. Multiple attributes may be requested by " + "providing this argument multiple times. If no request attributes " + "are provided, then the entries returned will include all user " + "attributes. This argument must not be used in conjunction with " + "the --ldapURL argument.";
attributes = new StringArgument('A', "attribute", false, 0, "{name}", description);
attributes.setArgumentGroupName("Search Arguments");
parser.addArgument(attributes);
description = "An LDAP URL that provides the base DN, scope, filter, and " + "requested attributes to use for the search requests (the address " + "and port components of the URL, if present, will be ignored). It " + "may be a simple LDAP URL or a value pattern to specify a range of " + "URLs. See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete " + "details about the value pattern syntax. If this argument is " + "provided, then none of the --baseDN, --scope, --filter, or " + "--attribute arguments may be used.";
ldapURL = new StringArgument(null, "ldapURL", false, 1, "{url}", description);
ldapURL.setArgumentGroupName("Search Arguments");
ldapURL.addLongIdentifier("ldap-url", true);
parser.addArgument(ldapURL);
description = "The maximum number of entries that the server should " + "return in response to each search request. A value of zero " + "indicates that the client does not wish to impose any limit on " + "the number of entries that are returned (although the server may " + "impose its own limit). If this is not provided, then a default " + "value of zero will be used.";
sizeLimit = new IntegerArgument('z', "sizeLimit", false, 1, "{num}", description, 0, Integer.MAX_VALUE, 0);
sizeLimit.setArgumentGroupName("Search Arguments");
sizeLimit.addLongIdentifier("size-limit", true);
parser.addArgument(sizeLimit);
description = "The maximum length of time, in seconds, that the server " + "should spend processing each search request. A value of zero " + "indicates that the client does not wish to impose any limit on the " + "server's processing time (although the server may impose its own " + "limit). If this is not provided, then a default value of zero " + "will be used.";
timeLimitSeconds = new IntegerArgument('l', "timeLimitSeconds", false, 1, "{seconds}", description, 0, Integer.MAX_VALUE, 0);
timeLimitSeconds.setArgumentGroupName("Search Arguments");
timeLimitSeconds.addLongIdentifier("time-limit-seconds", true);
timeLimitSeconds.addLongIdentifier("timeLimit", true);
timeLimitSeconds.addLongIdentifier("time-limit", true);
parser.addArgument(timeLimitSeconds);
final Set<String> derefAllowedValues = StaticUtils.setOf("never", "always", "search", "find");
description = "The alias dereferencing policy to use for search " + "requests. The value should be one of 'never', 'always', 'search', " + "or 'find'. If this is not provided, then a default value of " + "'never' will be used.";
dereferencePolicy = new StringArgument(null, "dereferencePolicy", false, 1, "{never|always|search|find}", description, derefAllowedValues, "never");
dereferencePolicy.setArgumentGroupName("Search Arguments");
dereferencePolicy.addLongIdentifier("dereference-policy", true);
parser.addArgument(dereferencePolicy);
description = "Indicates that server should only include the names of " + "the attributes contained in matching entries rather than both " + "names and values.";
typesOnly = new BooleanArgument(null, "typesOnly", 1, description);
typesOnly.setArgumentGroupName("Search Arguments");
typesOnly.addLongIdentifier("types-only", true);
parser.addArgument(typesOnly);
description = "Indicates that search requests should include the " + "assertion request control with the specified filter.";
assertionFilter = new FilterArgument(null, "assertionFilter", false, 1, "{filter}", description);
assertionFilter.setArgumentGroupName("Request Control Arguments");
assertionFilter.addLongIdentifier("assertion-filter", true);
parser.addArgument(assertionFilter);
description = "Indicates that search requests should include the simple " + "paged results control with the specified page size.";
simplePageSize = new IntegerArgument(null, "simplePageSize", false, 1, "{size}", description, 1, Integer.MAX_VALUE);
simplePageSize.setArgumentGroupName("Request Control Arguments");
simplePageSize.addLongIdentifier("simple-page-size", true);
parser.addArgument(simplePageSize);
description = "Indicates that search requests should include the " + "server-side sort request control with the specified sort order. " + "This should be a comma-delimited list in which each item is an " + "attribute name, optionally preceded by a plus or minus sign (to " + "indicate ascending or descending order; where ascending order is " + "the default), and optionally followed by a colon and the name or " + "OID of the desired ordering matching rule (if this is not " + "provided, the the attribute type's default ordering rule will be " + "used).";
sortOrder = new StringArgument(null, "sortOrder", false, 1, "{sortOrder}", description);
sortOrder.setArgumentGroupName("Request Control Arguments");
sortOrder.addLongIdentifier("sort-order", true);
parser.addArgument(sortOrder);
description = "Indicates that the proxied authorization control (as " + "defined in RFC 4370) should be used to request that operations be " + "processed using an alternate authorization identity. This may be " + "a simple authorization ID or it may be a value pattern to specify " + "a range of identities. See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the value pattern syntax.";
proxyAs = new StringArgument('Y', "proxyAs", false, 1, "{authzID}", description);
proxyAs.setArgumentGroupName("Request Control Arguments");
proxyAs.addLongIdentifier("proxy-as", true);
parser.addArgument(proxyAs);
description = "Indicates that search requests should include the " + "specified request control. This may be provided multiple times to " + "include multiple request controls.";
control = new ControlArgument('J', "control", false, 0, null, description);
control.setArgumentGroupName("Request Control Arguments");
parser.addArgument(control);
description = "The number of threads to use to perform the searches. If " + "this is not provided, then a default of one thread will be used.";
numThreads = new IntegerArgument('t', "numThreads", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 1);
numThreads.setArgumentGroupName("Rate Management Arguments");
numThreads.addLongIdentifier("num-threads", true);
parser.addArgument(numThreads);
description = "The length of time in seconds between output lines. If " + "this is not provided, then a default interval of five seconds will " + "be used.";
collectionInterval = new IntegerArgument('i', "intervalDuration", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 5);
collectionInterval.setArgumentGroupName("Rate Management Arguments");
collectionInterval.addLongIdentifier("interval-duration", true);
parser.addArgument(collectionInterval);
description = "The maximum number of intervals for which to run. If " + "this is not provided, then the tool will run until it is " + "interrupted.";
numIntervals = new IntegerArgument('I', "numIntervals", true, 1, "{num}", description, 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
numIntervals.setArgumentGroupName("Rate Management Arguments");
numIntervals.addLongIdentifier("num-intervals", true);
parser.addArgument(numIntervals);
description = "The number of search iterations that should be processed " + "on a connection before that connection is closed and replaced with " + "a newly-established (and authenticated, if appropriate) " + "connection. If this is not provided, then connections will not " + "be periodically closed and re-established.";
iterationsBeforeReconnect = new IntegerArgument(null, "iterationsBeforeReconnect", false, 1, "{num}", description, 0);
iterationsBeforeReconnect.setArgumentGroupName("Rate Management Arguments");
iterationsBeforeReconnect.addLongIdentifier("iterations-before-reconnect", true);
parser.addArgument(iterationsBeforeReconnect);
description = "The target number of searches to perform per second. It " + "is still necessary to specify a sufficient number of threads for " + "achieving this rate. If neither this option nor " + "--variableRateData is provided, then the tool will run at the " + "maximum rate for the specified number of threads.";
ratePerSecond = new IntegerArgument('r', "ratePerSecond", false, 1, "{searches-per-second}", description, 1, Integer.MAX_VALUE);
ratePerSecond.setArgumentGroupName("Rate Management Arguments");
ratePerSecond.addLongIdentifier("rate-per-second", true);
parser.addArgument(ratePerSecond);
final String variableRateDataArgName = "variableRateData";
final String generateSampleRateFileArgName = "generateSampleRateFile";
description = RateAdjustor.getVariableRateDataArgumentDescription(generateSampleRateFileArgName);
variableRateData = new FileArgument(null, variableRateDataArgName, false, 1, "{path}", description, true, true, true, false);
variableRateData.setArgumentGroupName("Rate Management Arguments");
variableRateData.addLongIdentifier("variable-rate-data", true);
parser.addArgument(variableRateData);
description = RateAdjustor.getGenerateSampleVariableRateFileDescription(variableRateDataArgName);
sampleRateFile = new FileArgument(null, generateSampleRateFileArgName, false, 1, "{path}", description, false, true, true, false);
sampleRateFile.setArgumentGroupName("Rate Management Arguments");
sampleRateFile.addLongIdentifier("generate-sample-rate-file", true);
sampleRateFile.setUsageArgument(true);
parser.addArgument(sampleRateFile);
parser.addExclusiveArgumentSet(variableRateData, sampleRateFile);
description = "The number of intervals to complete before beginning " + "overall statistics collection. Specifying a nonzero number of " + "warm-up intervals gives the client and server a chance to warm up " + "without skewing performance results.";
warmUpIntervals = new IntegerArgument(null, "warmUpIntervals", true, 1, "{num}", description, 0, Integer.MAX_VALUE, 0);
warmUpIntervals.setArgumentGroupName("Rate Management Arguments");
warmUpIntervals.addLongIdentifier("warm-up-intervals", true);
parser.addArgument(warmUpIntervals);
description = "Indicates the format to use for timestamps included in " + "the output. A value of 'none' indicates that no timestamps should " + "be included. A value of 'with-date' indicates that both the date " + "and the time should be included. A value of 'without-date' " + "indicates that only the time should be included.";
final Set<String> allowedFormats = StaticUtils.setOf("none", "with-date", "without-date");
timestampFormat = new StringArgument(null, "timestampFormat", true, 1, "{format}", description, allowedFormats, "none");
timestampFormat.addLongIdentifier("timestamp-format", true);
parser.addArgument(timestampFormat);
description = "Indicates that the client should operate in asynchronous " + "mode, in which it will not be necessary to wait for a response to " + "a previous request before sending the next request. Either the " + "'--ratePerSecond' or the '--maxOutstandingRequests' argument must " + "be provided to limit the number of outstanding requests.";
asynchronousMode = new BooleanArgument('a', "asynchronous", description);
parser.addArgument(asynchronousMode);
description = "Specifies the maximum number of outstanding requests " + "that should be allowed when operating in asynchronous mode.";
maxOutstandingRequests = new IntegerArgument('O', "maxOutstandingRequests", false, 1, "{num}", description, 1, Integer.MAX_VALUE, (Integer) null);
maxOutstandingRequests.addLongIdentifier("max-outstanding-requests", true);
parser.addArgument(maxOutstandingRequests);
description = "Indicates that information about the result codes for " + "failed operations should not be displayed.";
suppressErrors = new BooleanArgument(null, "suppressErrorResultCodes", 1, description);
suppressErrors.addLongIdentifier("suppress-error-result-codes", true);
parser.addArgument(suppressErrors);
description = "Generate output in CSV format rather than a " + "display-friendly format";
csvFormat = new BooleanArgument('c', "csv", 1, description);
parser.addArgument(csvFormat);
description = "Specifies the seed to use for the random number generator.";
randomSeed = new IntegerArgument('R', "randomSeed", false, 1, "{value}", description);
randomSeed.addLongIdentifier("random-seed", true);
parser.addArgument(randomSeed);
parser.addExclusiveArgumentSet(baseDN, ldapURL);
parser.addExclusiveArgumentSet(scope, ldapURL);
parser.addExclusiveArgumentSet(filter, ldapURL);
parser.addExclusiveArgumentSet(attributes, ldapURL);
parser.addRequiredArgumentSet(filter, ldapURL);
parser.addDependentArgumentSet(asynchronousMode, ratePerSecond, maxOutstandingRequests);
parser.addDependentArgumentSet(maxOutstandingRequests, asynchronousMode);
parser.addExclusiveArgumentSet(asynchronousMode, simplePageSize);
}
use of com.unboundid.util.args.FilterArgument in project ldapsdk by pingidentity.
the class ModRate 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 {
String description = "The DN of the entry to modify. It may be a simple " + "DN or a value pattern to specify a range of DN (e.g., " + "\"uid=user.[1-1000],ou=People,dc=example,dc=com\"). See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the " + "value pattern syntax. This must be provided.";
entryDN = new StringArgument('b', "entryDN", true, 1, "{dn}", description);
entryDN.setArgumentGroupName("Modification Arguments");
entryDN.addLongIdentifier("entry-dn", true);
parser.addArgument(entryDN);
description = "The name of the attribute to modify. Multiple attributes " + "may be specified by providing this argument multiple " + "times. At least one attribute must be specified.";
attribute = new StringArgument('A', "attribute", true, 0, "{name}", description);
attribute.setArgumentGroupName("Modification Arguments");
parser.addArgument(attribute);
description = "The pattern to use to generate values for the replace " + "modifications. If this is provided, then neither the " + "--valueLength argument nor the --characterSet arguments " + "may be provided.";
valuePattern = new StringArgument(null, "valuePattern", false, 1, "{pattern}", description);
valuePattern.setArgumentGroupName("Modification Arguments");
valuePattern.addLongIdentifier("value-pattern", true);
parser.addArgument(valuePattern);
description = "The length in bytes to use when generating values for the " + "replace modifications. If this is not provided, then a " + "default length of ten bytes will be used.";
valueLength = new IntegerArgument('l', "valueLength", false, 1, "{num}", description, 1, Integer.MAX_VALUE);
valueLength.setArgumentGroupName("Modification Arguments");
valueLength.addLongIdentifier("value-length", true);
parser.addArgument(valueLength);
description = "The number of values to include in replace " + "modifications. If this is not provided, then a default " + "of one value will be used.";
valueCount = new IntegerArgument(null, "valueCount", false, 1, "{num}", description, 0, Integer.MAX_VALUE, 1);
valueCount.setArgumentGroupName("Modification Arguments");
valueCount.addLongIdentifier("value-count", true);
parser.addArgument(valueCount);
description = "Indicates that the tool should use the increment " + "modification type rather than the replace modification " + "type.";
increment = new BooleanArgument(null, "increment", 1, description);
increment.setArgumentGroupName("Modification Arguments");
parser.addArgument(increment);
description = "The amount by which to increment values when using the " + "increment modification type. The amount may be negative " + "if values should be decremented rather than incremented. " + "If this is not provided, then a default increment amount " + "of one will be used.";
incrementAmount = new IntegerArgument(null, "incrementAmount", false, 1, null, description, Integer.MIN_VALUE, Integer.MAX_VALUE, 1);
incrementAmount.setArgumentGroupName("Modification Arguments");
incrementAmount.addLongIdentifier("increment-amount", true);
parser.addArgument(incrementAmount);
description = "The set of characters to use to generate the values for " + "the modifications. It should only include ASCII " + "characters. If this is not provided, then a default set " + "of lowercase alphabetic characters will be used.";
characterSet = new StringArgument('C', "characterSet", false, 1, "{chars}", description);
characterSet.setArgumentGroupName("Modification Arguments");
characterSet.addLongIdentifier("character-set", true);
parser.addArgument(characterSet);
description = "Indicates that modify requests should include the " + "assertion request control with the specified filter.";
assertionFilter = new FilterArgument(null, "assertionFilter", false, 1, "{filter}", description);
assertionFilter.setArgumentGroupName("Request Control Arguments");
assertionFilter.addLongIdentifier("assertion-filter", true);
parser.addArgument(assertionFilter);
description = "Indicates that modify requests should include the " + "permissive modify request control.";
permissiveModify = new BooleanArgument(null, "permissiveModify", 1, description);
permissiveModify.setArgumentGroupName("Request Control Arguments");
permissiveModify.addLongIdentifier("permissive-modify", true);
parser.addArgument(permissiveModify);
description = "Indicates that modify requests should include the " + "pre-read request control with the specified requested " + "attribute. This argument may be provided multiple times " + "to indicate that multiple requested attributes should be " + "included in the pre-read request control.";
preReadAttribute = new StringArgument(null, "preReadAttribute", false, 0, "{attribute}", description);
preReadAttribute.setArgumentGroupName("Request Control Arguments");
preReadAttribute.addLongIdentifier("pre-read-attribute", true);
parser.addArgument(preReadAttribute);
description = "Indicates that modify requests should include the " + "post-read request control with the specified requested " + "attribute. This argument may be provided multiple times " + "to indicate that multiple requested attributes should be " + "included in the post-read request control.";
postReadAttribute = new StringArgument(null, "postReadAttribute", false, 0, "{attribute}", description);
postReadAttribute.setArgumentGroupName("Request Control Arguments");
postReadAttribute.addLongIdentifier("post-read-attribute", true);
parser.addArgument(postReadAttribute);
description = "Indicates that the proxied authorization control (as " + "defined in RFC 4370) should be used to request that " + "operations be processed using an alternate authorization " + "identity. This may be a simple authorization ID or it " + "may be a value pattern to specify a range of " + "identities. See " + ValuePattern.PUBLIC_JAVADOC_URL + " for complete details about the value pattern syntax.";
proxyAs = new StringArgument('Y', "proxyAs", false, 1, "{authzID}", description);
proxyAs.setArgumentGroupName("Request Control Arguments");
proxyAs.addLongIdentifier("proxy-as", true);
parser.addArgument(proxyAs);
description = "Indicates that modify requests should include the " + "specified request control. This may be provided multiple " + "times to include multiple request controls.";
control = new ControlArgument('J', "control", false, 0, null, description);
control.setArgumentGroupName("Request Control Arguments");
parser.addArgument(control);
description = "The number of threads to use to perform the " + "modifications. If this is not provided, a single thread " + "will be used.";
numThreads = new IntegerArgument('t', "numThreads", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 1);
numThreads.setArgumentGroupName("Rate Management Arguments");
numThreads.addLongIdentifier("num-threads", true);
parser.addArgument(numThreads);
description = "The length of time in seconds between output lines. If " + "this is not provided, then a default interval of five " + "seconds will be used.";
collectionInterval = new IntegerArgument('i', "intervalDuration", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 5);
collectionInterval.setArgumentGroupName("Rate Management Arguments");
collectionInterval.addLongIdentifier("interval-duration", true);
parser.addArgument(collectionInterval);
description = "The maximum number of intervals for which to run. If " + "this is not provided, then the tool will run until it is " + "interrupted.";
numIntervals = new IntegerArgument('I', "numIntervals", true, 1, "{num}", description, 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
numIntervals.setArgumentGroupName("Rate Management Arguments");
numIntervals.addLongIdentifier("num-intervals", true);
parser.addArgument(numIntervals);
description = "The number of modify iterations that should be processed " + "on a connection before that connection is closed and " + "replaced with a newly-established (and authenticated, if " + "appropriate) connection. If this is not provided, then " + "connections will not be periodically closed and " + "re-established.";
iterationsBeforeReconnect = new IntegerArgument(null, "iterationsBeforeReconnect", false, 1, "{num}", description, 0);
iterationsBeforeReconnect.setArgumentGroupName("Rate Management Arguments");
iterationsBeforeReconnect.addLongIdentifier("iterations-before-reconnect", true);
parser.addArgument(iterationsBeforeReconnect);
description = "The target number of modifies to perform per second. It " + "is still necessary to specify a sufficient number of " + "threads for achieving this rate. If neither this option " + "nor --variableRateData is provided, then the tool will " + "run at the maximum rate for the specified number of " + "threads.";
ratePerSecond = new IntegerArgument('r', "ratePerSecond", false, 1, "{modifies-per-second}", description, 1, Integer.MAX_VALUE);
ratePerSecond.setArgumentGroupName("Rate Management Arguments");
ratePerSecond.addLongIdentifier("rate-per-second", true);
parser.addArgument(ratePerSecond);
final String variableRateDataArgName = "variableRateData";
final String generateSampleRateFileArgName = "generateSampleRateFile";
description = RateAdjustor.getVariableRateDataArgumentDescription(generateSampleRateFileArgName);
variableRateData = new FileArgument(null, variableRateDataArgName, false, 1, "{path}", description, true, true, true, false);
variableRateData.setArgumentGroupName("Rate Management Arguments");
variableRateData.addLongIdentifier("variable-rate-data", true);
parser.addArgument(variableRateData);
description = RateAdjustor.getGenerateSampleVariableRateFileDescription(variableRateDataArgName);
sampleRateFile = new FileArgument(null, generateSampleRateFileArgName, false, 1, "{path}", description, false, true, true, false);
sampleRateFile.setArgumentGroupName("Rate Management Arguments");
sampleRateFile.addLongIdentifier("generate-sample-rate-file", true);
sampleRateFile.setUsageArgument(true);
parser.addArgument(sampleRateFile);
parser.addExclusiveArgumentSet(variableRateData, sampleRateFile);
description = "The number of intervals to complete before beginning " + "overall statistics collection. Specifying a nonzero " + "number of warm-up intervals gives the client and server " + "a chance to warm up without skewing performance results.";
warmUpIntervals = new IntegerArgument(null, "warmUpIntervals", true, 1, "{num}", description, 0, Integer.MAX_VALUE, 0);
warmUpIntervals.setArgumentGroupName("Rate Management Arguments");
warmUpIntervals.addLongIdentifier("warm-up-intervals", true);
parser.addArgument(warmUpIntervals);
description = "Indicates the format to use for timestamps included in " + "the output. A value of 'none' indicates that no " + "timestamps should be included. A value of 'with-date' " + "indicates that both the date and the time should be " + "included. A value of 'without-date' indicates that only " + "the time should be included.";
final Set<String> allowedFormats = StaticUtils.setOf("none", "with-date", "without-date");
timestampFormat = new StringArgument(null, "timestampFormat", true, 1, "{format}", description, allowedFormats, "none");
timestampFormat.addLongIdentifier("timestamp-format", true);
parser.addArgument(timestampFormat);
description = "Indicates that information about the result codes for " + "failed operations should not be displayed.";
suppressErrorsArgument = new BooleanArgument(null, "suppressErrorResultCodes", 1, description);
suppressErrorsArgument.addLongIdentifier("suppress-error-result-codes", true);
parser.addArgument(suppressErrorsArgument);
description = "Generate output in CSV format rather than a " + "display-friendly format";
csvFormat = new BooleanArgument('c', "csv", 1, description);
parser.addArgument(csvFormat);
description = "Specifies the seed to use for the random number generator.";
randomSeed = new IntegerArgument('R', "randomSeed", false, 1, "{value}", description);
randomSeed.addLongIdentifier("random-seed", true);
parser.addArgument(randomSeed);
// The incrementAmount argument can only be used if the increment argument
// is provided.
parser.addDependentArgumentSet(incrementAmount, increment);
// None of the valueLength, valueCount, characterSet, or valuePattern
// arguments can be used if the increment argument is provided.
parser.addExclusiveArgumentSet(increment, valueLength);
parser.addExclusiveArgumentSet(increment, valueCount);
parser.addExclusiveArgumentSet(increment, characterSet);
parser.addExclusiveArgumentSet(increment, valuePattern);
// The valuePattern argument cannot be used with either the valueLength or
// characterSet arguments.
parser.addExclusiveArgumentSet(valuePattern, valueLength);
parser.addExclusiveArgumentSet(valuePattern, characterSet);
}
Aggregations