use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class TestLDAPSDKPerformance method addToolArguments.
/**
* Adds the command-line arguments supported for use with this tool to the
* provided argument parser. The tool may need to retain references to the
* arguments (and/or the argument parser, if trailing arguments are allowed)
* to it in order to obtain their values for use in later processing.
*
* @param parser The argument parser to which the arguments are to be added.
*
* @throws ArgumentException If a problem occurs while adding any of the
* tool-specific arguments to the provided
* argument parser.
*/
@Override()
public void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
toolArg = new StringArgument(null, "tool", true, 1, "{searchrate|modrate|authrate|search-and-mod-rate}", "The tool to invoke against the LDAP listener. It may be one of " + "searchrate, modrate, authrate, or search-and-mod-rate. If " + "this is not provided, then the searchrate tool will be invoked.", StaticUtils.setOf(TOOL_NAME_SEARCHRATE, TOOL_NAME_MODRATE, TOOL_NAME_AUTHRATE, TOOL_NAME_SEARCH_AND_MOD_RATE), TOOL_NAME_SEARCHRATE);
toolArg.addLongIdentifier("toolName", true);
toolArg.addLongIdentifier("tool-name", true);
parser.addArgument(toolArg);
numThreadsArg = new IntegerArgument('t', "numThreads", true, 1, "{num}", "The number of concurrent threads (each using its own connection) " + "to use to process requests. If this is not provided, then a " + "single thread will be used.", 1, Integer.MAX_VALUE, 1);
numThreadsArg.addLongIdentifier("num-threads", true);
numThreadsArg.addLongIdentifier("threads", true);
parser.addArgument(numThreadsArg);
entriesPerSearchArg = new IntegerArgument(null, "entriesPerSearch", true, 1, "{num}", "The number of entries to return in response to each search " + "request. If this is provided, the value must be between 0 " + "and 100. If it is not provided, then a single entry will be " + "returned.", 0, 100, 1);
entriesPerSearchArg.addLongIdentifier("entries-per-search", true);
entriesPerSearchArg.addLongIdentifier("numEntries", true);
entriesPerSearchArg.addLongIdentifier("num-entries", true);
entriesPerSearchArg.addLongIdentifier("entries", true);
parser.addArgument(entriesPerSearchArg);
bindOnlyArg = new BooleanArgument(null, "bindOnly", 1, "Indicates that the authrate tool should only issue bind requests. " + "If this is not provided, the authrate tool will perform both " + "search and bind operations. This argument will only be used " + "in conjunction with the authrate tool.");
bindOnlyArg.addLongIdentifier("bind-only", true);
parser.addArgument(bindOnlyArg);
resultCodeArg = new IntegerArgument(null, "resultCode", true, 1, "{intValue}", "The integer value for the result code to return in response to " + "each request. If this is not provided, then a result code of " + "0 (success) will be returned.", 0, Integer.MAX_VALUE, ResultCode.SUCCESS_INT_VALUE);
resultCodeArg.addLongIdentifier("result-code", true);
parser.addArgument(resultCodeArg);
diagnosticMessageArg = new StringArgument(null, "diagnosticMessage", false, 1, "{message}", "The diagnostic message to return in response to each request. If " + "this is not provided, then no diagnostic message will be " + "returned.");
diagnosticMessageArg.addLongIdentifier("diagnostic-message", true);
diagnosticMessageArg.addLongIdentifier("errorMessage", true);
diagnosticMessageArg.addLongIdentifier("error-message", true);
diagnosticMessageArg.addLongIdentifier("message", true);
parser.addArgument(diagnosticMessageArg);
useSSLArg = new BooleanArgument('Z', "useSSL", 1, "Encrypt communication with SSL. If this argument is not provided, " + "then the communication will not be encrypted.");
useSSLArg.addLongIdentifier("use-ssl", true);
useSSLArg.addLongIdentifier("ssl", true);
useSSLArg.addLongIdentifier("useTLS", true);
useSSLArg.addLongIdentifier("use-tls", true);
useSSLArg.addLongIdentifier("tls", true);
parser.addArgument(useSSLArg);
numIntervalsArg = new IntegerArgument('I', "numIntervals", false, 1, "{num}", "The number of intervals to use when running the performance " + "measurement tool. If this argument is provided in " + "conjunction with the --warmUpIntervals argument, then the " + "warm-up intervals will not be included in this count, and the " + "total number of intervals run will be the sum of the two " + "values. If this argument is not provided, then the tool will " + "run until it is interrupted (e.g., by pressing Ctrl+C or by " + "killing the underlying Java process).", 0, Integer.MAX_VALUE);
numIntervalsArg.addLongIdentifier("num-intervals", true);
numIntervalsArg.addLongIdentifier("intervals", true);
parser.addArgument(numIntervalsArg);
intervalDurationSecondsArg = new IntegerArgument('i', "intervalDurationSeconds", true, 1, "{num}", "The length of time in seconds to use for each tool interval (that " + "is, the length of time between each line of output giving " + "statistical information for operations processed in that " + "interval). If this is not provided, then a default interval " + "duration of five seconds will be used.", 1, Integer.MAX_VALUE, 5);
intervalDurationSecondsArg.addLongIdentifier("interval-duration-seconds", true);
intervalDurationSecondsArg.addLongIdentifier("intervalDuration", true);
intervalDurationSecondsArg.addLongIdentifier("interval-duration", true);
parser.addArgument(intervalDurationSecondsArg);
warmUpIntervalsArg = new IntegerArgument(null, "warmUpIntervals", true, 1, "{num}", "The number of intervals to run before starting to actually " + "collect statistics to include in the final result. This can " + "give the JVM and JIT a chance to identify and optimize " + "hotspots in the code for the best and most stable " + "performance. If this is not provided, then no warm-up " + "intervals will be used and the tool will start collecting " + "statistics right away.", 0, Integer.MAX_VALUE, 0);
warmUpIntervalsArg.addLongIdentifier("warm-up-intervals", true);
warmUpIntervalsArg.addLongIdentifier("warmup-intervals", true);
warmUpIntervalsArg.addLongIdentifier("warmUp", true);
warmUpIntervalsArg.addLongIdentifier("warm-up", true);
parser.addArgument(warmUpIntervalsArg);
}
use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class IdentifyReferencesToMissingEntries method addNonLDAPArguments.
/**
* Adds the arguments needed by this command-line tool to the provided
* argument parser which are not related to connecting or authenticating to
* the directory server.
*
* @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 search base DN(s) to use to find entries with " + "references to other entries. At least one base DN must be " + "specified.";
baseDNArgument = new DNArgument('b', "baseDN", true, 0, "{dn}", description);
baseDNArgument.addLongIdentifier("base-dn", true);
parser.addArgument(baseDNArgument);
description = "The attribute(s) for which to find missing references. " + "At least one attribute must be specified, and each attribute " + "must be indexed for equality searches and have values which are DNs.";
attributeArgument = new StringArgument('A', "attribute", true, 0, "{attr}", description);
parser.addArgument(attributeArgument);
description = "The maximum number of entries to retrieve at a time when " + "attempting to find entries with references to other entries. This " + "requires that the authenticated user have permission to use the " + "simple paged results control, but it can avoid problems with the " + "server sending entries too quickly for the client to handle. By " + "default, the simple paged results control will not be used.";
pageSizeArgument = new IntegerArgument('z', "simplePageSize", false, 1, "{num}", description, 1, Integer.MAX_VALUE);
pageSizeArgument.addLongIdentifier("simple-page-size", true);
parser.addArgument(pageSizeArgument);
}
use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class IdentifyUniqueAttributeConflicts method addNonLDAPArguments.
/**
* Adds the arguments needed by this command-line tool to the provided
* argument parser which are not related to connecting or authenticating to
* the directory server.
*
* @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 search base DN(s) to use to find entries with " + "attributes for which to find uniqueness conflicts. At least one " + "base DN must be specified.";
baseDNArgument = new DNArgument('b', "baseDN", true, 0, "{dn}", description);
baseDNArgument.addLongIdentifier("base-dn", true);
parser.addArgument(baseDNArgument);
description = "A filter that will be used to identify the set of " + "entries in which to identify uniqueness conflicts. If this is not " + "specified, then all entries containing the target attribute(s) " + "will be examined.";
filterArgument = new FilterArgument('f', "filter", false, 1, "{filter}", description);
parser.addArgument(filterArgument);
description = "The attributes for which to find uniqueness conflicts. " + "At least one attribute must be specified, and each attribute " + "must be indexed for equality searches.";
attributeArgument = new StringArgument('A', "attribute", true, 0, "{attr}", description);
parser.addArgument(attributeArgument);
description = "Indicates the behavior to exhibit if multiple unique " + "attributes are provided. Allowed values are '" + BEHAVIOR_UNIQUE_WITHIN_ATTR + "' (indicates that each value only " + "needs to be unique within its own attribute type), '" + BEHAVIOR_UNIQUE_ACROSS_ATTRS_INCLUDING_SAME + "' (indicates that " + "each value needs to be unique across all of the specified " + "attributes), '" + BEHAVIOR_UNIQUE_ACROSS_ATTRS_EXCEPT_SAME + "' (indicates each value needs to be unique across all of the " + "specified attributes, except that multiple attributes in the same " + "entry are allowed to share the same value), and '" + BEHAVIOR_UNIQUE_IN_COMBINATION + "' (indicates that every " + "combination of the values of the specified attributes must be " + "unique across each entry).";
final Set<String> allowedValues = StaticUtils.setOf(BEHAVIOR_UNIQUE_WITHIN_ATTR, BEHAVIOR_UNIQUE_ACROSS_ATTRS_INCLUDING_SAME, BEHAVIOR_UNIQUE_ACROSS_ATTRS_EXCEPT_SAME, BEHAVIOR_UNIQUE_IN_COMBINATION);
multipleAttributeBehaviorArgument = new StringArgument('m', "multipleAttributeBehavior", false, 1, "{behavior}", description, allowedValues, BEHAVIOR_UNIQUE_WITHIN_ATTR);
multipleAttributeBehaviorArgument.addLongIdentifier("multiple-attribute-behavior", true);
parser.addArgument(multipleAttributeBehaviorArgument);
description = "The maximum number of entries to retrieve at a time when " + "attempting to find uniqueness conflicts. This requires that the " + "authenticated user have permission to use the simple paged results " + "control, but it can avoid problems with the server sending entries " + "too quickly for the client to handle. By default, the simple " + "paged results control will not be used.";
pageSizeArgument = new IntegerArgument('z', "simplePageSize", false, 1, "{num}", description, 1, Integer.MAX_VALUE);
pageSizeArgument.addLongIdentifier("simple-page-size", true);
parser.addArgument(pageSizeArgument);
description = "The time limit in seconds that will be used for search " + "requests attempting to identify conflicts for each value of any of " + "the unique attributes. This time limit is used to avoid sending " + "expensive unindexed search requests that can consume significant " + "server resources. If any of these search operations fails in a " + "way that indicates the requested time limit was exceeded, the " + "tool will abort its processing. A value of zero indicates that no " + "time limit will be enforced. If this argument is not provided, a " + "default time limit of " + DEFAULT_TIME_LIMIT_SECONDS + " will be used.";
timeLimitArgument = new IntegerArgument('l', "timeLimitSeconds", false, 1, "{num}", description, 0, Integer.MAX_VALUE, DEFAULT_TIME_LIMIT_SECONDS);
timeLimitArgument.addLongIdentifier("timeLimit", true);
timeLimitArgument.addLongIdentifier("time-limit-seconds", true);
timeLimitArgument.addLongIdentifier("time-limit", true);
parser.addArgument(timeLimitArgument);
}
use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class ValidateLDIF 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 path to the LDIF file to process. The tool " + "will automatically attempt to detect whether the file is " + "encrypted or compressed.";
ldifFile = new FileArgument('f', "ldifFile", true, 1, "{path}", description, true, true, true, false);
ldifFile.addLongIdentifier("ldif-file", true);
parser.addArgument(ldifFile);
// Add an argument that makes it possible to read a compressed LDIF file.
// Note that this argument is no longer needed for dealing with compressed
// files, since the tool will automatically detect whether a file is
// compressed. However, the argument is still provided for the purpose of
// backward compatibility.
description = "Indicates that the specified LDIF file is compressed " + "using gzip compression.";
isCompressed = new BooleanArgument('c', "isCompressed", description);
isCompressed.addLongIdentifier("is-compressed", true);
isCompressed.setHidden(true);
parser.addArgument(isCompressed);
// Add an argument that indicates that the tool should read the encryption
// passphrase from a file.
description = "Indicates that the specified LDIF file is encrypted and " + "that the encryption passphrase is contained in the specified " + "file. If the LDIF data is encrypted and this argument is not " + "provided, then the tool will interactively prompt for the " + "encryption passphrase.";
encryptionPassphraseFile = new FileArgument(null, "encryptionPassphraseFile", false, 1, null, description, true, true, true, false);
encryptionPassphraseFile.addLongIdentifier("encryption-passphrase-file", true);
encryptionPassphraseFile.addLongIdentifier("encryptionPasswordFile", true);
encryptionPassphraseFile.addLongIdentifier("encryption-password-file", true);
parser.addArgument(encryptionPassphraseFile);
description = "The path to the file to which rejected entries should be " + "written.";
rejectFile = new FileArgument('R', "rejectFile", false, 1, "{path}", description, false, true, true, false);
rejectFile.addLongIdentifier("reject-file", true);
parser.addArgument(rejectFile);
description = "The path to a directory containing one or more LDIF files " + "with the schema information to use. If this is provided, " + "then no LDAP communication will be performed.";
schemaDirectory = new FileArgument(null, "schemaDirectory", false, 1, "{path}", description, true, true, false, true);
schemaDirectory.addLongIdentifier("schema-directory", true);
parser.addArgument(schemaDirectory);
description = "The number of threads to use when processing the LDIF file.";
numThreads = new IntegerArgument('t', "numThreads", true, 1, "{num}", description, 1, Integer.MAX_VALUE, 1);
numThreads.addLongIdentifier("num-threads", true);
parser.addArgument(numThreads);
description = "Ignore validation failures due to entries containing " + "duplicate values for the same attribute.";
ignoreDuplicateValues = new BooleanArgument(null, "ignoreDuplicateValues", description);
ignoreDuplicateValues.setArgumentGroupName("Validation Strictness Arguments");
ignoreDuplicateValues.addLongIdentifier("ignore-duplicate-values", true);
parser.addArgument(ignoreDuplicateValues);
description = "Ignore validation failures due to object classes not " + "defined in the schema.";
ignoreUndefinedObjectClasses = new BooleanArgument(null, "ignoreUndefinedObjectClasses", description);
ignoreUndefinedObjectClasses.setArgumentGroupName("Validation Strictness Arguments");
ignoreUndefinedObjectClasses.addLongIdentifier("ignore-undefined-object-classes", true);
parser.addArgument(ignoreUndefinedObjectClasses);
description = "Ignore validation failures due to attributes not defined " + "in the schema.";
ignoreUndefinedAttributes = new BooleanArgument(null, "ignoreUndefinedAttributes", description);
ignoreUndefinedAttributes.setArgumentGroupName("Validation Strictness Arguments");
ignoreUndefinedAttributes.addLongIdentifier("ignore-undefined-attributes", true);
parser.addArgument(ignoreUndefinedAttributes);
description = "Ignore validation failures due to entries with malformed " + "DNs.";
ignoreMalformedDNs = new BooleanArgument(null, "ignoreMalformedDNs", description);
ignoreMalformedDNs.setArgumentGroupName("Validation Strictness Arguments");
ignoreMalformedDNs.addLongIdentifier("ignore-malformed-dns", true);
parser.addArgument(ignoreMalformedDNs);
description = "Ignore validation failures due to entries with RDN " + "attribute values that are missing from the set of entry " + "attributes.";
ignoreMissingRDNValues = new BooleanArgument(null, "ignoreMissingRDNValues", description);
ignoreMissingRDNValues.setArgumentGroupName("Validation Strictness Arguments");
ignoreMissingRDNValues.addLongIdentifier("ignore-missing-rdn-values", true);
parser.addArgument(ignoreMissingRDNValues);
description = "Ignore validation failures due to entries without exactly " + "structural object class.";
ignoreStructuralObjectClasses = new BooleanArgument(null, "ignoreStructuralObjectClasses", description);
ignoreStructuralObjectClasses.setArgumentGroupName("Validation Strictness Arguments");
ignoreStructuralObjectClasses.addLongIdentifier("ignore-structural-object-classes", true);
parser.addArgument(ignoreStructuralObjectClasses);
description = "Ignore validation failures due to entries with object " + "classes that are not allowed.";
ignoreProhibitedObjectClasses = new BooleanArgument(null, "ignoreProhibitedObjectClasses", description);
ignoreProhibitedObjectClasses.setArgumentGroupName("Validation Strictness Arguments");
ignoreProhibitedObjectClasses.addLongIdentifier("ignore-prohibited-object-classes", true);
parser.addArgument(ignoreProhibitedObjectClasses);
description = "Ignore validation failures due to entries that are " + "one or more superior object classes.";
ignoreMissingSuperiorObjectClasses = new BooleanArgument(null, "ignoreMissingSuperiorObjectClasses", description);
ignoreMissingSuperiorObjectClasses.setArgumentGroupName("Validation Strictness Arguments");
ignoreMissingSuperiorObjectClasses.addLongIdentifier("ignore-missing-superior-object-classes", true);
parser.addArgument(ignoreMissingSuperiorObjectClasses);
description = "Ignore validation failures due to entries with attributes " + "that are not allowed.";
ignoreProhibitedAttributes = new BooleanArgument(null, "ignoreProhibitedAttributes", description);
ignoreProhibitedAttributes.setArgumentGroupName("Validation Strictness Arguments");
ignoreProhibitedAttributes.addLongIdentifier("ignore-prohibited-attributes", true);
parser.addArgument(ignoreProhibitedAttributes);
description = "Ignore validation failures due to entries missing " + "required attributes.";
ignoreMissingAttributes = new BooleanArgument(null, "ignoreMissingAttributes", description);
ignoreMissingAttributes.setArgumentGroupName("Validation Strictness Arguments");
ignoreMissingAttributes.addLongIdentifier("ignore-missing-attributes", true);
parser.addArgument(ignoreMissingAttributes);
description = "Ignore validation failures due to entries with multiple " + "values for single-valued attributes.";
ignoreSingleValuedAttributes = new BooleanArgument(null, "ignoreSingleValuedAttributes", description);
ignoreSingleValuedAttributes.setArgumentGroupName("Validation Strictness Arguments");
ignoreSingleValuedAttributes.addLongIdentifier("ignore-single-valued-attributes", true);
parser.addArgument(ignoreSingleValuedAttributes);
description = "Ignore validation failures due to entries with attribute " + "values that violate their associated syntax. If this is " + "provided, then no attribute syntax violations will be " + "flagged. If this is not provided, then all attribute " + "syntax violations will be flagged except for violations " + "in those attributes excluded by the " + "--ignoreSyntaxViolationsForAttribute argument.";
ignoreAttributeSyntax = new BooleanArgument(null, "ignoreAttributeSyntax", description);
ignoreAttributeSyntax.setArgumentGroupName("Validation Strictness Arguments");
ignoreAttributeSyntax.addLongIdentifier("ignore-attribute-syntax", true);
parser.addArgument(ignoreAttributeSyntax);
description = "The name or OID of an attribute for which to ignore " + "validation failures due to violations of the associated " + "attribute syntax. This argument can only be used if the " + "--ignoreAttributeSyntax argument is not provided.";
ignoreSyntaxViolationsForAttribute = new StringArgument(null, "ignoreSyntaxViolationsForAttribute", false, 0, "{attr}", description);
ignoreSyntaxViolationsForAttribute.setArgumentGroupName("Validation Strictness Arguments");
ignoreSyntaxViolationsForAttribute.addLongIdentifier("ignore-syntax-violations-for-attribute", true);
parser.addArgument(ignoreSyntaxViolationsForAttribute);
description = "Ignore validation failures due to entries with RDNs " + "that violate the associated name form definition.";
ignoreNameForms = new BooleanArgument(null, "ignoreNameForms", description);
ignoreNameForms.setArgumentGroupName("Validation Strictness Arguments");
ignoreNameForms.addLongIdentifier("ignore-name-forms", true);
parser.addArgument(ignoreNameForms);
// The ignoreAttributeSyntax and ignoreAttributeSyntaxForAttribute arguments
// cannot be used together.
parser.addExclusiveArgumentSet(ignoreAttributeSyntax, ignoreSyntaxViolationsForAttribute);
}
use of com.unboundid.util.args.IntegerArgument in project ldapsdk by pingidentity.
the class MoveSubtree method addNonLDAPArguments.
/**
* {@inheritDoc}
*/
@Override()
public void addNonLDAPArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
baseDN = new DNArgument('b', "baseDN", false, 0, INFO_MOVE_SUBTREE_ARG_BASE_DN_PLACEHOLDER.get(), INFO_MOVE_SUBTREE_ARG_BASE_DN_DESCRIPTION.get());
baseDN.addLongIdentifier("entryDN", true);
parser.addArgument(baseDN);
baseDNFile = new FileArgument('f', "baseDNFile", false, 1, INFO_MOVE_SUBTREE_ARG_BASE_DN_FILE_PLACEHOLDER.get(), INFO_MOVE_SUBTREE_ARG_BASE_DN_FILE_DESCRIPTION.get(), true, true, true, false);
baseDNFile.addLongIdentifier("entryDNFile", true);
parser.addArgument(baseDNFile);
sizeLimit = new IntegerArgument('z', "sizeLimit", false, 1, INFO_MOVE_SUBTREE_ARG_SIZE_LIMIT_PLACEHOLDER.get(), INFO_MOVE_SUBTREE_ARG_SIZE_LIMIT_DESCRIPTION.get(), 0, Integer.MAX_VALUE, 0);
parser.addArgument(sizeLimit);
purpose = new StringArgument(null, "purpose", false, 1, INFO_MOVE_SUBTREE_ARG_PURPOSE_PLACEHOLDER.get(), INFO_MOVE_SUBTREE_ARG_PURPOSE_DESCRIPTION.get());
parser.addArgument(purpose);
verbose = new BooleanArgument('v', "verbose", 1, INFO_MOVE_SUBTREE_ARG_VERBOSE_DESCRIPTION.get());
parser.addArgument(verbose);
parser.addRequiredArgumentSet(baseDN, baseDNFile);
parser.addExclusiveArgumentSet(baseDN, baseDNFile);
}
Aggregations