Search in sources :

Example 1 with ScopeArgument

use of com.unboundid.util.args.ScopeArgument 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);
}
Also used : ControlArgument(com.unboundid.util.args.ControlArgument) ScopeArgument(com.unboundid.util.args.ScopeArgument) FilterArgument(com.unboundid.util.args.FilterArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Example 2 with ScopeArgument

use of com.unboundid.util.args.ScopeArgument 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);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ControlArgument(com.unboundid.util.args.ControlArgument) ScopeArgument(com.unboundid.util.args.ScopeArgument) FilterArgument(com.unboundid.util.args.FilterArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Example 3 with ScopeArgument

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

the class LDAPSearch method addNonLDAPArguments.

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

Example 4 with ScopeArgument

use of com.unboundid.util.args.ScopeArgument 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);
}
Also used : ControlArgument(com.unboundid.util.args.ControlArgument) ScopeArgument(com.unboundid.util.args.ScopeArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Example 5 with ScopeArgument

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

the class TransformLDIF method addToolArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    // Add arguments pertaining to the source and target LDIF files.
    sourceLDIF = new FileArgument('l', "sourceLDIF", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_SOURCE_LDIF.get(), true, true, true, false);
    sourceLDIF.addLongIdentifier("inputLDIF", true);
    sourceLDIF.addLongIdentifier("source-ldif", true);
    sourceLDIF.addLongIdentifier("input-ldif", true);
    sourceLDIF.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(sourceLDIF);
    sourceFromStandardInput = new BooleanArgument(null, "sourceFromStandardInput", 1, INFO_TRANSFORM_LDIF_ARG_DESC_SOURCE_STD_IN.get());
    sourceFromStandardInput.addLongIdentifier("source-from-standard-input", true);
    sourceFromStandardInput.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(sourceFromStandardInput);
    parser.addRequiredArgumentSet(sourceLDIF, sourceFromStandardInput);
    parser.addExclusiveArgumentSet(sourceLDIF, sourceFromStandardInput);
    targetLDIF = new FileArgument('o', "targetLDIF", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_TARGET_LDIF.get(), false, true, true, false);
    targetLDIF.addLongIdentifier("outputLDIF", true);
    targetLDIF.addLongIdentifier("target-ldif", true);
    targetLDIF.addLongIdentifier("output-ldif", true);
    targetLDIF.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(targetLDIF);
    targetToStandardOutput = new BooleanArgument(null, "targetToStandardOutput", 1, INFO_TRANSFORM_LDIF_ARG_DESC_TARGET_STD_OUT.get());
    targetToStandardOutput.addLongIdentifier("target-to-standard-output", true);
    targetToStandardOutput.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(targetToStandardOutput);
    parser.addExclusiveArgumentSet(targetLDIF, targetToStandardOutput);
    sourceContainsChangeRecords = new BooleanArgument(null, "sourceContainsChangeRecords", INFO_TRANSFORM_LDIF_ARG_DESC_SOURCE_CONTAINS_CHANGE_RECORDS.get());
    sourceContainsChangeRecords.addLongIdentifier("source-contains-change-records", true);
    sourceContainsChangeRecords.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(sourceContainsChangeRecords);
    appendToTargetLDIF = new BooleanArgument(null, "appendToTargetLDIF", INFO_TRANSFORM_LDIF_ARG_DESC_APPEND_TO_TARGET.get());
    appendToTargetLDIF.addLongIdentifier("append-to-target-ldif", true);
    appendToTargetLDIF.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(appendToTargetLDIF);
    parser.addExclusiveArgumentSet(targetToStandardOutput, appendToTargetLDIF);
    wrapColumn = new IntegerArgument(null, "wrapColumn", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_WRAP_COLUMN.get(), 5, Integer.MAX_VALUE);
    wrapColumn.addLongIdentifier("wrap-column", true);
    wrapColumn.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(wrapColumn);
    sourceCompressed = new BooleanArgument('C', "sourceCompressed", INFO_TRANSFORM_LDIF_ARG_DESC_SOURCE_COMPRESSED.get());
    sourceCompressed.addLongIdentifier("inputCompressed", true);
    sourceCompressed.addLongIdentifier("source-compressed", true);
    sourceCompressed.addLongIdentifier("input-compressed", true);
    sourceCompressed.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(sourceCompressed);
    compressTarget = new BooleanArgument('c', "compressTarget", INFO_TRANSFORM_LDIF_ARG_DESC_COMPRESS_TARGET.get());
    compressTarget.addLongIdentifier("compressOutput", true);
    compressTarget.addLongIdentifier("compress", true);
    compressTarget.addLongIdentifier("compress-target", true);
    compressTarget.addLongIdentifier("compress-output", true);
    compressTarget.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(compressTarget);
    encryptTarget = new BooleanArgument(null, "encryptTarget", INFO_TRANSFORM_LDIF_ARG_DESC_ENCRYPT_TARGET.get());
    encryptTarget.addLongIdentifier("encryptOutput", true);
    encryptTarget.addLongIdentifier("encrypt", true);
    encryptTarget.addLongIdentifier("encrypt-target", true);
    encryptTarget.addLongIdentifier("encrypt-output", true);
    encryptTarget.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(encryptTarget);
    encryptionPassphraseFile = new FileArgument(null, "encryptionPassphraseFile", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_ENCRYPTION_PW_FILE.get(), true, true, true, false);
    encryptionPassphraseFile.addLongIdentifier("encryptionPasswordFile", true);
    encryptionPassphraseFile.addLongIdentifier("encryption-passphrase-file", true);
    encryptionPassphraseFile.addLongIdentifier("encryption-password-file", true);
    encryptionPassphraseFile.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_LDIF.get());
    parser.addArgument(encryptionPassphraseFile);
    // Add arguments pertaining to attribute scrambling.
    scrambleAttribute = new StringArgument('a', "scrambleAttribute", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_SCRAMBLE_ATTR.get());
    scrambleAttribute.addLongIdentifier("attributeName", true);
    scrambleAttribute.addLongIdentifier("scramble-attribute", true);
    scrambleAttribute.addLongIdentifier("attribute-name", true);
    scrambleAttribute.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SCRAMBLE.get());
    parser.addArgument(scrambleAttribute);
    scrambleJSONField = new StringArgument(null, "scrambleJSONField", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_FIELD_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_SCRAMBLE_JSON_FIELD.get(scrambleAttribute.getIdentifierString()));
    scrambleJSONField.addLongIdentifier("scramble-json-field", true);
    scrambleJSONField.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SCRAMBLE.get());
    parser.addArgument(scrambleJSONField);
    parser.addDependentArgumentSet(scrambleJSONField, scrambleAttribute);
    randomSeed = new IntegerArgument('s', "randomSeed", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_RANDOM_SEED.get());
    randomSeed.addLongIdentifier("random-seed", true);
    randomSeed.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SCRAMBLE.get());
    parser.addArgument(randomSeed);
    // Add arguments pertaining to replacing attribute values with a generated
    // value using a sequential counter.
    sequentialAttribute = new StringArgument('S', "sequentialAttribute", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_SEQUENTIAL_ATTR.get(sourceContainsChangeRecords.getIdentifierString()));
    sequentialAttribute.addLongIdentifier("sequentialAttributeName", true);
    sequentialAttribute.addLongIdentifier("sequential-attribute", true);
    sequentialAttribute.addLongIdentifier("sequential-attribute-name", true);
    sequentialAttribute.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SEQUENTIAL.get());
    parser.addArgument(sequentialAttribute);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, sequentialAttribute);
    initialSequentialValue = new IntegerArgument('i', "initialSequentialValue", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_INITIAL_SEQUENTIAL_VALUE.get(sequentialAttribute.getIdentifierString()));
    initialSequentialValue.addLongIdentifier("initial-sequential-value", true);
    initialSequentialValue.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SEQUENTIAL.get());
    parser.addArgument(initialSequentialValue);
    parser.addDependentArgumentSet(initialSequentialValue, sequentialAttribute);
    sequentialValueIncrement = new IntegerArgument(null, "sequentialValueIncrement", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_SEQUENTIAL_INCREMENT.get(sequentialAttribute.getIdentifierString()));
    sequentialValueIncrement.addLongIdentifier("sequential-value-increment", true);
    sequentialValueIncrement.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SEQUENTIAL.get());
    parser.addArgument(sequentialValueIncrement);
    parser.addDependentArgumentSet(sequentialValueIncrement, sequentialAttribute);
    textBeforeSequentialValue = new StringArgument(null, "textBeforeSequentialValue", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_SEQUENTIAL_TEXT_BEFORE.get(sequentialAttribute.getIdentifierString()));
    textBeforeSequentialValue.addLongIdentifier("text-before-sequential-value", true);
    textBeforeSequentialValue.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SEQUENTIAL.get());
    parser.addArgument(textBeforeSequentialValue);
    parser.addDependentArgumentSet(textBeforeSequentialValue, sequentialAttribute);
    textAfterSequentialValue = new StringArgument(null, "textAfterSequentialValue", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_SEQUENTIAL_TEXT_AFTER.get(sequentialAttribute.getIdentifierString()));
    textAfterSequentialValue.addLongIdentifier("text-after-sequential-value", true);
    textAfterSequentialValue.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_SEQUENTIAL.get());
    parser.addArgument(textAfterSequentialValue);
    parser.addDependentArgumentSet(textAfterSequentialValue, sequentialAttribute);
    // Add arguments pertaining to attribute value replacement.
    replaceValuesAttribute = new StringArgument(null, "replaceValuesAttribute", false, 1, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_REPLACE_VALUES_ATTR.get(sourceContainsChangeRecords.getIdentifierString()));
    replaceValuesAttribute.addLongIdentifier("replace-values-attribute", true);
    replaceValuesAttribute.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_REPLACE_VALUES.get());
    parser.addArgument(replaceValuesAttribute);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, replaceValuesAttribute);
    replacementValue = new StringArgument(null, "replacementValue", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_REPLACEMENT_VALUE.get(replaceValuesAttribute.getIdentifierString()));
    replacementValue.addLongIdentifier("replacement-value", true);
    replacementValue.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_REPLACE_VALUES.get());
    parser.addArgument(replacementValue);
    parser.addDependentArgumentSet(replaceValuesAttribute, replacementValue);
    parser.addDependentArgumentSet(replacementValue, replaceValuesAttribute);
    // Add arguments pertaining to adding missing attributes.
    addAttributeName = new StringArgument(null, "addAttributeName", false, 1, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_ADD_ATTR.get("--addAttributeValue", sourceContainsChangeRecords.getIdentifierString()));
    addAttributeName.addLongIdentifier("add-attribute-name", true);
    addAttributeName.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addAttributeName);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, addAttributeName);
    addAttributeValue = new StringArgument(null, "addAttributeValue", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_ADD_VALUE.get(addAttributeName.getIdentifierString()));
    addAttributeValue.addLongIdentifier("add-attribute-value", true);
    addAttributeValue.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addAttributeValue);
    parser.addDependentArgumentSet(addAttributeName, addAttributeValue);
    parser.addDependentArgumentSet(addAttributeValue, addAttributeName);
    addToExistingValues = new BooleanArgument(null, "addToExistingValues", INFO_TRANSFORM_LDIF_ARG_DESC_ADD_MERGE_VALUES.get(addAttributeName.getIdentifierString(), addAttributeValue.getIdentifierString()));
    addToExistingValues.addLongIdentifier("add-to-existing-values", true);
    addToExistingValues.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addToExistingValues);
    parser.addDependentArgumentSet(addToExistingValues, addAttributeName);
    addAttributeBaseDN = new DNArgument(null, "addAttributeBaseDN", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_ADD_BASE_DN.get(addAttributeName.getIdentifierString()));
    addAttributeBaseDN.addLongIdentifier("add-attribute-base-dn", true);
    addAttributeBaseDN.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addAttributeBaseDN);
    parser.addDependentArgumentSet(addAttributeBaseDN, addAttributeName);
    addAttributeScope = new ScopeArgument(null, "addAttributeScope", false, null, INFO_TRANSFORM_LDIF_ARG_DESC_ADD_SCOPE.get(addAttributeBaseDN.getIdentifierString(), addAttributeName.getIdentifierString()));
    addAttributeScope.addLongIdentifier("add-attribute-scope", true);
    addAttributeScope.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addAttributeScope);
    parser.addDependentArgumentSet(addAttributeScope, addAttributeName);
    addAttributeFilter = new FilterArgument(null, "addAttributeFilter", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_ADD_FILTER.get(addAttributeName.getIdentifierString()));
    addAttributeFilter.addLongIdentifier("add-attribute-filter", true);
    addAttributeFilter.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_ADD_ATTR.get());
    parser.addArgument(addAttributeFilter);
    parser.addDependentArgumentSet(addAttributeFilter, addAttributeName);
    // Add arguments pertaining to renaming attributes.
    renameAttributeFrom = new StringArgument(null, "renameAttributeFrom", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_RENAME_FROM.get());
    renameAttributeFrom.addLongIdentifier("rename-attribute-from", true);
    renameAttributeFrom.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_RENAME.get());
    parser.addArgument(renameAttributeFrom);
    renameAttributeTo = new StringArgument(null, "renameAttributeTo", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_RENAME_TO.get(renameAttributeFrom.getIdentifierString()));
    renameAttributeTo.addLongIdentifier("rename-attribute-to", true);
    renameAttributeTo.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_RENAME.get());
    parser.addArgument(renameAttributeTo);
    parser.addDependentArgumentSet(renameAttributeFrom, renameAttributeTo);
    parser.addDependentArgumentSet(renameAttributeTo, renameAttributeFrom);
    // Add arguments pertaining to flattening subtrees.
    flattenBaseDN = new DNArgument(null, "flattenBaseDN", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_FLATTEN_BASE_DN.get());
    flattenBaseDN.addLongIdentifier("flatten-base-dn", true);
    flattenBaseDN.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_FLATTEN.get());
    parser.addArgument(flattenBaseDN);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, flattenBaseDN);
    flattenAddOmittedRDNAttributesToEntry = new BooleanArgument(null, "flattenAddOmittedRDNAttributesToEntry", 1, INFO_TRANSFORM_LDIF_ARG_DESC_FLATTEN_ADD_OMITTED_TO_ENTRY.get());
    flattenAddOmittedRDNAttributesToEntry.addLongIdentifier("flatten-add-omitted-rdn-attributes-to-entry", true);
    flattenAddOmittedRDNAttributesToEntry.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_FLATTEN.get());
    parser.addArgument(flattenAddOmittedRDNAttributesToEntry);
    parser.addDependentArgumentSet(flattenAddOmittedRDNAttributesToEntry, flattenBaseDN);
    flattenAddOmittedRDNAttributesToRDN = new BooleanArgument(null, "flattenAddOmittedRDNAttributesToRDN", 1, INFO_TRANSFORM_LDIF_ARG_DESC_FLATTEN_ADD_OMITTED_TO_RDN.get());
    flattenAddOmittedRDNAttributesToRDN.addLongIdentifier("flatten-add-omitted-rdn-attributes-to-rdn", true);
    flattenAddOmittedRDNAttributesToRDN.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_FLATTEN.get());
    parser.addArgument(flattenAddOmittedRDNAttributesToRDN);
    parser.addDependentArgumentSet(flattenAddOmittedRDNAttributesToRDN, flattenBaseDN);
    flattenExcludeFilter = new FilterArgument(null, "flattenExcludeFilter", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_FLATTEN_EXCLUDE_FILTER.get());
    flattenExcludeFilter.addLongIdentifier("flatten-exclude-filter", true);
    flattenExcludeFilter.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_FLATTEN.get());
    parser.addArgument(flattenExcludeFilter);
    parser.addDependentArgumentSet(flattenExcludeFilter, flattenBaseDN);
    // Add arguments pertaining to moving subtrees.
    moveSubtreeFrom = new DNArgument(null, "moveSubtreeFrom", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_MOVE_SUBTREE_FROM.get());
    moveSubtreeFrom.addLongIdentifier("move-subtree-from", true);
    moveSubtreeFrom.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_MOVE.get());
    parser.addArgument(moveSubtreeFrom);
    moveSubtreeTo = new DNArgument(null, "moveSubtreeTo", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_MOVE_SUBTREE_TO.get(moveSubtreeFrom.getIdentifierString()));
    moveSubtreeTo.addLongIdentifier("move-subtree-to", true);
    moveSubtreeTo.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_MOVE.get());
    parser.addArgument(moveSubtreeTo);
    parser.addDependentArgumentSet(moveSubtreeFrom, moveSubtreeTo);
    parser.addDependentArgumentSet(moveSubtreeTo, moveSubtreeFrom);
    // Add arguments pertaining to redacting attribute values.
    redactAttribute = new StringArgument(null, "redactAttribute", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_REDACT_ATTR.get());
    redactAttribute.addLongIdentifier("redact-attribute", true);
    redactAttribute.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_REDACT.get());
    parser.addArgument(redactAttribute);
    hideRedactedValueCount = new BooleanArgument(null, "hideRedactedValueCount", INFO_TRANSFORM_LDIF_ARG_DESC_HIDE_REDACTED_COUNT.get());
    hideRedactedValueCount.addLongIdentifier("hide-redacted-value-count", true);
    hideRedactedValueCount.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_REDACT.get());
    parser.addArgument(hideRedactedValueCount);
    parser.addDependentArgumentSet(hideRedactedValueCount, redactAttribute);
    // Add arguments pertaining to excluding attributes and entries.
    excludeAttribute = new StringArgument(null, "excludeAttribute", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_ATTR_NAME.get(), INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_ATTR.get());
    excludeAttribute.addLongIdentifier("suppressAttribute", true);
    excludeAttribute.addLongIdentifier("exclude-attribute", true);
    excludeAttribute.addLongIdentifier("suppress-attribute", true);
    excludeAttribute.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeAttribute);
    excludeEntryBaseDN = new DNArgument(null, "excludeEntryBaseDN", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_ENTRY_BASE_DN.get(sourceContainsChangeRecords.getIdentifierString()));
    excludeEntryBaseDN.addLongIdentifier("suppressEntryBaseDN", true);
    excludeEntryBaseDN.addLongIdentifier("exclude-entry-base-dn", true);
    excludeEntryBaseDN.addLongIdentifier("suppress-entry-base-dn", true);
    excludeEntryBaseDN.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeEntryBaseDN);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, excludeEntryBaseDN);
    excludeEntryScope = new ScopeArgument(null, "excludeEntryScope", false, null, INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_ENTRY_SCOPE.get(sourceContainsChangeRecords.getIdentifierString()));
    excludeEntryScope.addLongIdentifier("suppressEntryScope", true);
    excludeEntryScope.addLongIdentifier("exclude-entry-scope", true);
    excludeEntryScope.addLongIdentifier("suppress-entry-scope", true);
    excludeEntryScope.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeEntryScope);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, excludeEntryScope);
    excludeEntryFilter = new FilterArgument(null, "excludeEntryFilter", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_ENTRY_FILTER.get(sourceContainsChangeRecords.getIdentifierString()));
    excludeEntryFilter.addLongIdentifier("suppressEntryFilter", true);
    excludeEntryFilter.addLongIdentifier("exclude-entry-filter", true);
    excludeEntryFilter.addLongIdentifier("suppress-entry-filter", true);
    excludeEntryFilter.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeEntryFilter);
    parser.addExclusiveArgumentSet(sourceContainsChangeRecords, excludeEntryFilter);
    excludeNonMatchingEntries = new BooleanArgument(null, "excludeNonMatchingEntries", INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_NON_MATCHING.get());
    excludeNonMatchingEntries.addLongIdentifier("exclude-non-matching-entries", true);
    excludeNonMatchingEntries.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeNonMatchingEntries);
    parser.addDependentArgumentSet(excludeNonMatchingEntries, excludeEntryBaseDN, excludeEntryScope, excludeEntryFilter);
    // Add arguments for excluding records based on their change types.
    excludeChangeType = new StringArgument(null, "excludeChangeType", false, 0, INFO_TRANSFORM_LDIF_PLACEHOLDER_CHANGE_TYPES.get(), INFO_TRANSFORM_LDIF_ARG_DESC_EXCLUDE_CHANGE_TYPE.get(), StaticUtils.setOf("add", "delete", "modify", "moddn"));
    excludeChangeType.addLongIdentifier("exclude-change-type", true);
    excludeChangeType.addLongIdentifier("exclude-changetype", true);
    excludeChangeType.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeChangeType);
    // Add arguments for excluding records that don't have a change type.
    excludeRecordsWithoutChangeType = new BooleanArgument(null, "excludeRecordsWithoutChangeType", 1, INFO_TRANSFORM_LDIF_EXCLUDE_WITHOUT_CHANGETYPE.get());
    excludeRecordsWithoutChangeType.addLongIdentifier("exclude-records-without-change-type", true);
    excludeRecordsWithoutChangeType.addLongIdentifier("exclude-records-without-changetype", true);
    excludeRecordsWithoutChangeType.setArgumentGroupName(INFO_TRANSFORM_LDIF_ARG_GROUP_EXCLUDE.get());
    parser.addArgument(excludeRecordsWithoutChangeType);
    // Add the remaining arguments.
    schemaPath = new FileArgument(null, "schemaPath", false, 0, null, INFO_TRANSFORM_LDIF_ARG_DESC_SCHEMA_PATH.get(), true, true, false, false);
    schemaPath.addLongIdentifier("schemaFile", true);
    schemaPath.addLongIdentifier("schemaDirectory", true);
    schemaPath.addLongIdentifier("schema-path", true);
    schemaPath.addLongIdentifier("schema-file", true);
    schemaPath.addLongIdentifier("schema-directory", true);
    parser.addArgument(schemaPath);
    numThreads = new IntegerArgument('t', "numThreads", false, 1, null, INFO_TRANSFORM_LDIF_ARG_DESC_NUM_THREADS.get(), 1, Integer.MAX_VALUE, 1);
    numThreads.addLongIdentifier("num-threads", true);
    parser.addArgument(numThreads);
    processDNs = new BooleanArgument('d', "processDNs", INFO_TRANSFORM_LDIF_ARG_DESC_PROCESS_DNS.get());
    processDNs.addLongIdentifier("process-dns", true);
    parser.addArgument(processDNs);
    // Ensure that at least one kind of transformation was requested.
    parser.addRequiredArgumentSet(scrambleAttribute, sequentialAttribute, replaceValuesAttribute, addAttributeName, renameAttributeFrom, flattenBaseDN, moveSubtreeFrom, redactAttribute, excludeAttribute, excludeEntryBaseDN, excludeEntryScope, excludeEntryFilter, excludeChangeType, excludeRecordsWithoutChangeType);
}
Also used : DNArgument(com.unboundid.util.args.DNArgument) ScopeArgument(com.unboundid.util.args.ScopeArgument) FilterArgument(com.unboundid.util.args.FilterArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Aggregations

BooleanArgument (com.unboundid.util.args.BooleanArgument)9 IntegerArgument (com.unboundid.util.args.IntegerArgument)9 ScopeArgument (com.unboundid.util.args.ScopeArgument)9 FileArgument (com.unboundid.util.args.FileArgument)8 StringArgument (com.unboundid.util.args.StringArgument)8 ControlArgument (com.unboundid.util.args.ControlArgument)6 DNArgument (com.unboundid.util.args.DNArgument)6 FilterArgument (com.unboundid.util.args.FilterArgument)6 BooleanValueArgument (com.unboundid.util.args.BooleanValueArgument)2 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)1 ArgumentListArgument (com.unboundid.util.args.ArgumentListArgument)1 ArgumentParser (com.unboundid.util.args.ArgumentParser)1 DurationArgument (com.unboundid.util.args.DurationArgument)1 TimestampArgument (com.unboundid.util.args.TimestampArgument)1 LinkedHashSet (java.util.LinkedHashSet)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1