use of com.unboundid.util.args.IntegerArgument 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.IntegerArgument in project ldapsdk by pingidentity.
the class LDAPDebugger 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 address on which to listen for client " + "connections. If this is not provided, then it will listen on " + "all interfaces.";
listenAddress = new StringArgument('a', "listenAddress", false, 1, "{address}", description);
listenAddress.addLongIdentifier("listen-address", true);
parser.addArgument(listenAddress);
description = "The port on which to listen for client connections. If " + "no value is provided, then a free port will be automatically " + "selected.";
listenPort = new IntegerArgument('L', "listenPort", true, 1, "{port}", description, 0, 65_535, 0);
listenPort.addLongIdentifier("listen-port", true);
parser.addArgument(listenPort);
description = "Use SSL when accepting client connections. This is " + "independent of the '--useSSL' option, which applies only to " + "communication between the LDAP debugger and the backend server. " + "If this argument is provided, then either the --keyStorePath or " + "the --generateSelfSignedCertificate argument must also be provided.";
listenUsingSSL = new BooleanArgument('S', "listenUsingSSL", 1, description);
listenUsingSSL.addLongIdentifier("listen-using-ssl", true);
parser.addArgument(listenUsingSSL);
description = "Generate a self-signed certificate to present to clients " + "when the --listenUsingSSL argument is provided. This argument " + "cannot be used in conjunction with the --keyStorePath argument.";
generateSelfSignedCertificate = new BooleanArgument(null, "generateSelfSignedCertificate", 1, description);
generateSelfSignedCertificate.addLongIdentifier("generate-self-signed-certificate", true);
parser.addArgument(generateSelfSignedCertificate);
description = "The path to the output file to be written. If no value " + "is provided, then the output will be written to standard output.";
outputFile = new FileArgument('f', "outputFile", false, 1, "{path}", description, false, true, true, false);
outputFile.addLongIdentifier("output-file", true);
parser.addArgument(outputFile);
description = "The path to the a code log file to be written. If a " + "value is provided, then the tool will generate sample code that " + "corresponds to the requests received from clients. If no value is " + "provided, then no code log will be generated.";
codeLogFile = new FileArgument('c', "codeLogFile", false, 1, "{path}", description, false, true, true, false);
codeLogFile.addLongIdentifier("code-log-file", true);
parser.addArgument(codeLogFile);
// If --listenUsingSSL is provided, then either the --keyStorePath argument
// or the --generateSelfSignedCertificate argument must also be provided.
final Argument keyStorePathArgument = parser.getNamedArgument("keyStorePath");
parser.addDependentArgumentSet(listenUsingSSL, keyStorePathArgument, generateSelfSignedCertificate);
// The --generateSelfSignedCertificate argument cannot be used with any of
// the arguments pertaining to a key store path.
final Argument keyStorePasswordArgument = parser.getNamedArgument("keyStorePassword");
final Argument keyStorePasswordFileArgument = parser.getNamedArgument("keyStorePasswordFile");
final Argument promptForKeyStorePasswordArgument = parser.getNamedArgument("promptForKeyStorePassword");
parser.addExclusiveArgumentSet(generateSelfSignedCertificate, keyStorePathArgument);
parser.addExclusiveArgumentSet(generateSelfSignedCertificate, keyStorePasswordArgument);
parser.addExclusiveArgumentSet(generateSelfSignedCertificate, keyStorePasswordFileArgument);
parser.addExclusiveArgumentSet(generateSelfSignedCertificate, promptForKeyStorePasswordArgument);
}
use of com.unboundid.util.args.IntegerArgument 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);
}
use of com.unboundid.util.args.IntegerArgument 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);
}
use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class AuthRate 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 Authentication 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, a " + "default scope of 'sub' will be used.";
scopeArg = new ScopeArgument('s', "scope", false, "{scope}", description, SearchScope.SUB);
scopeArg.setArgumentGroupName("Search and Authentication 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", false, 1, "{filter}", description);
filter.setArgumentGroupName("Search and Authentication 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 return " + "attributes are specified, then entries will be returned " + "with all user attributes.";
attributes = new StringArgument('A', "attribute", false, 0, "{name}", description);
attributes.setArgumentGroupName("Search and Authentication Arguments");
parser.addArgument(attributes);
description = "The password to use when binding as the users returned " + "from the searches. This must be provided.";
userPassword = new StringArgument('C', "credentials", true, 1, "{password}", description);
userPassword.setSensitive(true);
userPassword.setArgumentGroupName("Search and Authentication Arguments");
parser.addArgument(userPassword);
description = "Indicates that the tool should only perform bind " + "operations without the initial search. If this argument " + "is provided, then the base DN pattern will be used to " + "obtain the bind DNs.";
bindOnly = new BooleanArgument('B', "bindOnly", 1, description);
bindOnly.setArgumentGroupName("Search and Authentication Arguments");
bindOnly.addLongIdentifier("bind-only", true);
parser.addArgument(bindOnly);
parser.addRequiredArgumentSet(filter, bindOnly);
description = "The type of authentication to perform. Allowed values " + "are: SIMPLE, CRAM-MD5, DIGEST-MD5, and PLAIN. If no " + "value is provided, then SIMPLE authentication will be " + "performed.";
final Set<String> allowedAuthTypes = StaticUtils.setOf("simple", "cram-md5", "digest-md5", "plain");
authType = new StringArgument('a', "authType", true, 1, "{authType}", description, allowedAuthTypes, "simple");
authType.setArgumentGroupName("Search and Authentication Arguments");
authType.addLongIdentifier("auth-type", true);
parser.addArgument(authType);
description = "Indicates that bind requests should include the " + "authorization identity request control as described in " + "RFC 3829.";
authorizationIdentityRequestControl = new BooleanArgument(null, "authorizationIdentityRequestControl", 1, description);
authorizationIdentityRequestControl.setArgumentGroupName("Request Control Arguments");
authorizationIdentityRequestControl.addLongIdentifier("authorization-identity-request-control", true);
parser.addArgument(authorizationIdentityRequestControl);
description = "Indicates that bind requests should include the " + "password policy request control as described in " + "draft-behera-ldap-password-policy-10.";
passwordPolicyRequestControl = new BooleanArgument(null, "passwordPolicyRequestControl", 1, description);
passwordPolicyRequestControl.setArgumentGroupName("Request Control Arguments");
passwordPolicyRequestControl.addLongIdentifier("password-policy-request-control", true);
parser.addArgument(passwordPolicyRequestControl);
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 bind requests should include the " + "specified request control. This may be provided multiple " + "times to include multiple modify request controls.";
bindControl = new ControlArgument(null, "bindControl", false, 0, null, description);
bindControl.setArgumentGroupName("Request Control Arguments");
bindControl.addLongIdentifier("bind-control", true);
parser.addArgument(bindControl);
description = "The number of threads to use to perform the " + "authentication processing. 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 target number of authorizations 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, "{auths-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);
}
Aggregations