use of com.unboundid.util.args.BooleanArgument in project ldapsdk by pingidentity.
the class ManageCertificates method getKeystorePath.
/**
* Retrieves the path to the target key store file.
*
* @param keystoreArgumentName The name of the argument used to specify the
* path to the target key store.
*
* @return The path to the target keystore file, or {@code null} if no
* keystore path was configured.
*/
@Nullable()
private File getKeystorePath(@NotNull final String keystoreArgumentName) {
final FileArgument keystoreArgument = subCommandParser.getFileArgument(keystoreArgumentName);
if ((keystoreArgument != null) && keystoreArgument.isPresent()) {
return keystoreArgument.getValue();
}
final BooleanArgument useJVMDefaultTrustStoreArgument = subCommandParser.getBooleanArgument("useJVMDefaultTrustStore");
if ((useJVMDefaultTrustStoreArgument != null) && useJVMDefaultTrustStoreArgument.isPresent()) {
return JVM_DEFAULT_CACERTS_FILE;
}
return null;
}
use of com.unboundid.util.args.BooleanArgument in project ldapsdk by pingidentity.
the class ManageCertificates method doDeleteCertificate.
/**
* Performs the necessary processing for the delete-certificate subcommand.
*
* @return A result code that indicates whether the processing completed
* successfully.
*/
@NotNull()
private ResultCode doDeleteCertificate() {
// Get the values of a number of configured arguments.
final StringArgument aliasArgument = subCommandParser.getStringArgument("alias");
final String alias = aliasArgument.getValue();
final BooleanArgument noPromptArgument = subCommandParser.getBooleanArgument("no-prompt");
final boolean noPrompt = ((noPromptArgument != null) && noPromptArgument.isPresent());
final String keystoreType;
final File keystorePath = getKeystorePath();
try {
keystoreType = inferKeystoreType(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
final char[] keystorePassword;
try {
keystorePassword = getKeystorePassword(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
final BooleanArgument displayKeytoolCommandArgument = subCommandParser.getBooleanArgument("display-keytool-command");
if ((displayKeytoolCommandArgument != null) && displayKeytoolCommandArgument.isPresent()) {
final ArrayList<String> keytoolArgs = new ArrayList<>(10);
keytoolArgs.add("-delete");
keytoolArgs.add("-keystore");
keytoolArgs.add(keystorePath.getAbsolutePath());
keytoolArgs.add("-storetype");
keytoolArgs.add(keystoreType);
keytoolArgs.add("-storepass");
keytoolArgs.add("*****REDACTED*****");
keytoolArgs.add("-alias");
keytoolArgs.add(alias);
displayKeytoolCommand(keytoolArgs);
}
// Get the keystore.
final KeyStore keystore;
try {
keystore = getKeystore(keystoreType, keystorePath, keystorePassword);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
// Get the entry for the specified alias.
final boolean hasPrivateKey;
final ArrayList<X509Certificate> certList = new ArrayList<>(5);
if (hasCertificateAlias(keystore, alias)) {
try {
hasPrivateKey = false;
certList.add(new X509Certificate(keystore.getCertificate(alias).getEncoded()));
} catch (final Exception e) {
Debug.debugException(e);
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_DELETE_CERT_ERROR_GETTING_CERT.get(alias));
e.printStackTrace(getErr());
return ResultCode.LOCAL_ERROR;
}
} else if (hasKeyAlias(keystore, alias)) {
try {
hasPrivateKey = true;
for (final Certificate c : keystore.getCertificateChain(alias)) {
certList.add(new X509Certificate(c.getEncoded()));
}
} catch (final Exception e) {
Debug.debugException(e);
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_DELETE_CERT_ERROR_GETTING_CHAIN.get(alias));
e.printStackTrace(getErr());
return ResultCode.LOCAL_ERROR;
}
} else {
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_DELETE_CERT_ERROR_ALIAS_NOT_CERT_OR_KEY.get(alias));
return ResultCode.PARAM_ERROR;
}
// Prompt about whether to perform the delete, if appropriate.
if (!noPrompt) {
out();
if (!hasPrivateKey) {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_DELETE_CERT_CONFIRM_DELETE_CERT.get());
} else {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_DELETE_CERT_CONFIRM_DELETE_CHAIN.get());
}
for (final X509Certificate c : certList) {
out();
printCertificate(c, "", false);
}
out();
try {
if (!promptForYesNo(INFO_MANAGE_CERTS_DELETE_CERT_PROMPT_DELETE.get())) {
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_DELETE_CERT_CANCELED.get());
return ResultCode.USER_CANCELED;
}
} catch (final LDAPException le) {
Debug.debugException(le);
err();
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
}
// Delete the entry from the keystore.
try {
keystore.deleteEntry(alias);
} catch (final Exception e) {
Debug.debugException(e);
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_DELETE_CERT_DELETE_ERROR.get(alias));
e.printStackTrace(getErr());
return ResultCode.LOCAL_ERROR;
}
// Write the updated keystore to disk.
try {
writeKeystore(keystore, keystorePath, keystorePassword);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
if (certList.size() == 1) {
out();
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_DELETE_CERT_DELETED_CERT.get());
} else {
out();
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_DELETE_CERT_DELETED_CHAIN.get());
}
return ResultCode.SUCCESS;
}
use of com.unboundid.util.args.BooleanArgument in project ldapsdk by pingidentity.
the class ManageCertificates method doListCertificates.
/**
* Performs the necessary processing for the list-certificates subcommand.
*
* @return A result code that indicates whether the processing completed
* successfully.
*/
@NotNull()
private ResultCode doListCertificates() {
// Get the values of a number of configured arguments.
final BooleanArgument displayPEMArgument = subCommandParser.getBooleanArgument("display-pem-certificate");
final boolean displayPEM = ((displayPEMArgument != null) && displayPEMArgument.isPresent());
final BooleanArgument verboseArgument = subCommandParser.getBooleanArgument("verbose");
final boolean verbose = ((verboseArgument != null) && verboseArgument.isPresent());
final Map<String, String> missingAliases;
final Set<String> aliases;
final StringArgument aliasArgument = subCommandParser.getStringArgument("alias");
if ((aliasArgument == null) || (!aliasArgument.isPresent())) {
aliases = Collections.emptySet();
missingAliases = Collections.emptyMap();
} else {
final List<String> values = aliasArgument.getValues();
aliases = new LinkedHashSet<>(StaticUtils.computeMapCapacity(values.size()));
missingAliases = new LinkedHashMap<>(StaticUtils.computeMapCapacity(values.size()));
for (final String alias : values) {
final String lowerAlias = StaticUtils.toLowerCase(alias);
aliases.add(StaticUtils.toLowerCase(lowerAlias));
missingAliases.put(lowerAlias, alias);
}
}
final String keystoreType;
final File keystorePath = getKeystorePath();
try {
keystoreType = inferKeystoreType(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
final char[] keystorePassword;
try {
keystorePassword = getKeystorePassword(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
final BooleanArgument displayKeytoolCommandArgument = subCommandParser.getBooleanArgument("display-keytool-command");
if ((displayKeytoolCommandArgument != null) && displayKeytoolCommandArgument.isPresent()) {
final ArrayList<String> keytoolArgs = new ArrayList<>(10);
keytoolArgs.add("-list");
keytoolArgs.add("-keystore");
keytoolArgs.add(keystorePath.getAbsolutePath());
keytoolArgs.add("-storetype");
keytoolArgs.add(keystoreType);
if (keystorePassword != null) {
keytoolArgs.add("-storepass");
keytoolArgs.add("*****REDACTED*****");
}
for (final String alias : missingAliases.values()) {
keytoolArgs.add("-alias");
keytoolArgs.add(alias);
}
if (displayPEM) {
keytoolArgs.add("-rfc");
}
if (verbose) {
keytoolArgs.add("-v");
}
displayKeytoolCommand(keytoolArgs);
}
// Get the keystore.
final KeyStore keystore;
try {
keystore = getKeystore(keystoreType, keystorePath, keystorePassword);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
// Display a message with the keystore type.
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_LIST_KEYSTORE_TYPE.get(keystoreType));
// Iterate through the keystore and display the appropriate certificates.
final Enumeration<String> aliasEnumeration;
try {
aliasEnumeration = keystore.aliases();
} catch (final Exception e) {
Debug.debugException(e);
err();
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_LIST_CERTS_CANNOT_GET_ALIASES.get(keystorePath.getAbsolutePath()));
e.printStackTrace(getErr());
return ResultCode.LOCAL_ERROR;
}
int listedCount = 0;
ResultCode resultCode = ResultCode.SUCCESS;
while (aliasEnumeration.hasMoreElements()) {
final String alias = aliasEnumeration.nextElement();
final String lowerAlias = StaticUtils.toLowerCase(alias);
if ((!aliases.isEmpty()) && (missingAliases.remove(lowerAlias) == null)) {
// We don't care about this alias.
continue;
}
final X509Certificate[] certificateChain;
try {
// NOTE: Keystore entries that have private keys may have a certificate
// chain associated with them (the end certificate plus all of the
// issuer certificates). In that case all of those certificates in the
// chain will be stored under the same alias, and the only way we can
// access them is to call the getCertificateChain method. However, if
// the keystore only has a certificate for the alias but no private key,
// then the entry will not have a chain, and the call to
// getCertificateChain will return null for that alias. We want to be
// able to handle both of these cases, so we will first try
// getCertificateChain to see if we can get a complete chain, but if
// that returns null, then use getCertificate to see if we can get a
// single certificate. That call to getCertificate can also return null
// because the entry with this alias might be some other type of entry,
// like a secret key entry.
Certificate[] chain = keystore.getCertificateChain(alias);
if ((chain == null) || (chain.length == 0)) {
final Certificate cert = keystore.getCertificate(alias);
if (cert == null) {
continue;
} else {
chain = new Certificate[] { cert };
}
}
certificateChain = new X509Certificate[chain.length];
for (int i = 0; i < chain.length; i++) {
certificateChain[i] = new X509Certificate(chain[i].getEncoded());
}
} catch (final Exception e) {
Debug.debugException(e);
err();
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_LIST_CERTS_ERROR_GETTING_CERT.get(alias, StaticUtils.getExceptionMessage(e)));
resultCode = ResultCode.LOCAL_ERROR;
continue;
}
listedCount++;
for (int i = 0; i < certificateChain.length; i++) {
out();
if (certificateChain.length == 1) {
out(INFO_MANAGE_CERTS_LIST_CERTS_LABEL_ALIAS_WITHOUT_CHAIN.get(alias));
} else {
out(INFO_MANAGE_CERTS_LIST_CERTS_LABEL_ALIAS_WITH_CHAIN.get(alias, (i + 1), certificateChain.length));
}
printCertificate(certificateChain[i], "", verbose);
if (i == 0) {
if (hasKeyAlias(keystore, alias)) {
out(INFO_MANAGE_CERTS_LIST_CERTS_LABEL_HAS_PK_YES.get());
} else {
out(INFO_MANAGE_CERTS_LIST_CERTS_LABEL_HAS_PK_NO.get());
}
}
CertException signatureVerificationException = null;
if (certificateChain[i].isSelfSigned()) {
try {
certificateChain[i].verifySignature(null);
} catch (final CertException ce) {
Debug.debugException(ce);
signatureVerificationException = ce;
}
} else {
X509Certificate issuerCertificate = null;
try {
final AtomicReference<KeyStore> jvmDefaultTrustStoreRef = new AtomicReference<>();
final AtomicReference<DN> missingIssuerRef = new AtomicReference<>();
issuerCertificate = getIssuerCertificate(certificateChain[i], keystore, jvmDefaultTrustStoreRef, missingIssuerRef);
} catch (final Exception e) {
Debug.debugException(e);
}
if (issuerCertificate == null) {
signatureVerificationException = new CertException(ERR_MANAGE_CERTS_LIST_CERTS_VERIFY_SIGNATURE_NO_ISSUER.get(certificateChain[i].getIssuerDN()));
} else {
try {
certificateChain[i].verifySignature(issuerCertificate);
} catch (final CertException ce) {
Debug.debugException(ce);
signatureVerificationException = ce;
}
}
}
if (signatureVerificationException == null) {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_LIST_CERTS_SIGNATURE_VALID.get());
} else {
wrapErr(0, WRAP_COLUMN, signatureVerificationException.getMessage());
}
if (displayPEM) {
out(INFO_MANAGE_CERTS_LIST_CERTS_LABEL_PEM.get());
writePEMCertificate(getOut(), certificateChain[i].getX509CertificateBytes());
}
}
}
if (!missingAliases.isEmpty()) {
err();
for (final String missingAlias : missingAliases.values()) {
wrapErr(0, WRAP_COLUMN, WARN_MANAGE_CERTS_LIST_CERTS_ALIAS_NOT_IN_KS.get(missingAlias, keystorePath.getAbsolutePath()));
resultCode = ResultCode.PARAM_ERROR;
}
} else if (listedCount == 0) {
out();
if (keystorePassword == null) {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_LIST_CERTS_NO_CERTS_OR_KEYS_WITHOUT_PW.get());
} else {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_LIST_CERTS_NO_CERTS_OR_KEYS_WITH_PW.get());
}
}
return resultCode;
}
use of com.unboundid.util.args.BooleanArgument in project ldapsdk by pingidentity.
the class ManageCertificates method doTrustServerCertificate.
/**
* Performs the necessary processing for the trust-server-certificate
* subcommand.
*
* @return A result code that indicates whether the processing completed
* successfully.
*/
@NotNull()
private ResultCode doTrustServerCertificate() {
// Get the values of a number of configured arguments.
final StringArgument hostnameArgument = subCommandParser.getStringArgument("hostname");
final String hostname = hostnameArgument.getValue();
final IntegerArgument portArgument = subCommandParser.getIntegerArgument("port");
final int port = portArgument.getValue();
final String alias;
final StringArgument aliasArgument = subCommandParser.getStringArgument("alias");
if ((aliasArgument != null) && aliasArgument.isPresent()) {
alias = aliasArgument.getValue();
} else {
alias = hostname + ':' + port;
}
final BooleanArgument useLDAPStartTLSArgument = subCommandParser.getBooleanArgument("use-ldap-start-tls");
final boolean useLDAPStartTLS = ((useLDAPStartTLSArgument != null) && useLDAPStartTLSArgument.isPresent());
final BooleanArgument issuersOnlyArgument = subCommandParser.getBooleanArgument("issuers-only");
final boolean issuersOnly = ((issuersOnlyArgument != null) && issuersOnlyArgument.isPresent());
final BooleanArgument noPromptArgument = subCommandParser.getBooleanArgument("no-prompt");
final boolean noPrompt = ((noPromptArgument != null) && noPromptArgument.isPresent());
final BooleanArgument verboseArgument = subCommandParser.getBooleanArgument("verbose");
final boolean verbose = ((verboseArgument != null) && verboseArgument.isPresent());
final String keystoreType;
final File keystorePath = getKeystorePath();
final boolean isNewKeystore = (!keystorePath.exists());
try {
keystoreType = inferKeystoreType(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
final char[] keystorePassword;
try {
keystorePassword = getKeystorePassword(keystorePath);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
// Get the keystore.
final KeyStore keystore;
try {
keystore = getKeystore(keystoreType, keystorePath, keystorePassword);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
// Make sure that the specified alias is not already in use.
if (hasCertificateAlias(keystore, alias) || hasKeyAlias(keystore, alias)) {
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_TRUST_SERVER_ALIAS_IN_USE.get(alias));
return ResultCode.PARAM_ERROR;
}
// Spawn a background thread to establish a connection and get the
// certificate chain from the target server.
final LinkedBlockingQueue<Object> responseQueue = new LinkedBlockingQueue<>(10);
final ManageCertificatesServerCertificateCollector certificateCollector = new ManageCertificatesServerCertificateCollector(this, hostname, port, useLDAPStartTLS, verbose, responseQueue);
certificateCollector.start();
Object responseObject = ERR_MANAGE_CERTS_TRUST_SERVER_NO_CERT_CHAIN_RECEIVED.get(hostname + ':' + port);
try {
responseObject = responseQueue.poll(90L, TimeUnit.SECONDS);
} catch (final Exception e) {
Debug.debugException(e);
}
final X509Certificate[] chain;
if (responseObject instanceof X509Certificate[]) {
chain = (X509Certificate[]) responseObject;
} else if (responseObject instanceof CertException) {
// thread, so we can just return a non-success result.
return ResultCode.LOCAL_ERROR;
} else {
wrapErr(0, WRAP_COLUMN, String.valueOf(responseObject));
return ResultCode.LOCAL_ERROR;
}
try {
certificateCollector.join(10_000L);
} catch (final Exception e) {
Debug.debugException(e);
}
// then do so now.
if (!noPrompt) {
out();
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_TRUST_SERVER_RETRIEVED_CHAIN.get(hostname + ':' + port));
boolean isFirst = true;
for (final X509Certificate c : chain) {
out();
if (isFirst) {
isFirst = false;
if (issuersOnly && (chain.length > 1)) {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_TRUST_SERVER_NOTE_OMITTED.get());
out();
}
}
printCertificate(c, "", verbose);
}
out();
try {
if (!promptForYesNo(INFO_MANAGE_CERTS_TRUST_SERVER_PROMPT_TRUST.get())) {
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_TRUST_SERVER_CHAIN_REJECTED.get());
return ResultCode.USER_CANCELED;
}
} catch (final LDAPException le) {
Debug.debugException(le);
err();
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
}
// Add the certificates to the keystore.
final LinkedHashMap<String, X509Certificate> certsByAlias = new LinkedHashMap<>(StaticUtils.computeMapCapacity(chain.length));
for (int i = 0; i < chain.length; i++) {
if (i == 0) {
if (issuersOnly && (chain.length > 1)) {
continue;
}
certsByAlias.put(alias, chain[i]);
} else if ((i == 1) && (chain.length == 2)) {
certsByAlias.put(alias + "-issuer", chain[i]);
} else {
certsByAlias.put(alias + "-issuer-" + i, chain[i]);
}
}
for (final Map.Entry<String, X509Certificate> e : certsByAlias.entrySet()) {
final String certAlias = e.getKey();
final X509Certificate cert = e.getValue();
try {
Validator.ensureFalse((hasCertificateAlias(keystore, certAlias) || hasKeyAlias(keystore, certAlias)), "ERROR: Alias '" + certAlias + "' is already in use in the " + "keystore.");
keystore.setCertificateEntry(certAlias, cert.toCertificate());
} catch (final Exception ex) {
Debug.debugException(ex);
wrapErr(0, WRAP_COLUMN, ERR_MANAGE_CERTS_TRUST_SERVER_ERROR_ADDING_CERT_TO_KS.get(cert.getSubjectDN()));
ex.printStackTrace(getErr());
return ResultCode.LOCAL_ERROR;
}
}
// Save the updated keystore.
try {
writeKeystore(keystore, keystorePath, keystorePassword);
} catch (final LDAPException le) {
Debug.debugException(le);
wrapErr(0, WRAP_COLUMN, le.getMessage());
return le.getResultCode();
}
if (isNewKeystore) {
out();
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_TRUST_SERVER_CERT_CREATED_KEYSTORE.get(getUserFriendlyKeystoreType(keystoreType)));
}
out();
if (certsByAlias.size() == 1) {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_TRUST_SERVER_ADDED_CERT_TO_KS.get());
} else {
wrapOut(0, WRAP_COLUMN, INFO_MANAGE_CERTS_TRUST_SERVER_ADDED_CERTS_TO_KS.get(certsByAlias.size()));
}
return ResultCode.SUCCESS;
}
use of com.unboundid.util.args.BooleanArgument in project ldapsdk by pingidentity.
the class LDAPDelete method addNonLDAPArguments.
/**
* {@inheritDoc}
*/
@Override()
public void addNonLDAPArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
this.parser = parser;
//
// Data Arguments
//
final String argGroupData = INFO_LDAPDELETE_ARG_GROUP_DATA.get();
entryDN = new DNArgument('b', "entryDN", false, 0, null, INFO_LDAPDELETE_ARG_DESC_DN.get());
entryDN.addLongIdentifier("entry-dn", true);
entryDN.addLongIdentifier("dn", true);
entryDN.addLongIdentifier("dnToDelete", true);
entryDN.addLongIdentifier("dn-to-delete", true);
entryDN.addLongIdentifier("entry", true);
entryDN.addLongIdentifier("entryToDelete", true);
entryDN.addLongIdentifier("entry-to-delete", true);
entryDN.setArgumentGroupName(argGroupData);
parser.addArgument(entryDN);
dnFile = new FileArgument('f', "dnFile", false, 0, null, INFO_LDAPDELETE_ARG_DESC_DN_FILE.get(), true, true, true, false);
dnFile.addLongIdentifier("dn-file", true);
dnFile.addLongIdentifier("dnFilename", true);
dnFile.addLongIdentifier("dn-filename", true);
dnFile.addLongIdentifier("deleteEntriesWithDNsFromFile", true);
dnFile.addLongIdentifier("delete-entries0-with-dns-from-file", true);
dnFile.addLongIdentifier("file", true);
dnFile.addLongIdentifier("filename", true);
dnFile.setArgumentGroupName(argGroupData);
parser.addArgument(dnFile);
deleteEntriesMatchingFilter = new FilterArgument(null, "deleteEntriesMatchingFilter", false, 0, null, INFO_LDAPDELETE_ARG_DESC_DELETE_ENTRIES_MATCHING_FILTER.get());
deleteEntriesMatchingFilter.addLongIdentifier("delete-entries-matching-filter", true);
deleteEntriesMatchingFilter.addLongIdentifier("deleteFilter", true);
deleteEntriesMatchingFilter.addLongIdentifier("delete-filter", true);
deleteEntriesMatchingFilter.addLongIdentifier("deleteSearchFilter", true);
deleteEntriesMatchingFilter.addLongIdentifier("delete-search-filter", true);
deleteEntriesMatchingFilter.addLongIdentifier("filter", true);
deleteEntriesMatchingFilter.setArgumentGroupName(argGroupData);
parser.addArgument(deleteEntriesMatchingFilter);
deleteEntriesMatchingFiltersFromFile = new FileArgument(null, "deleteEntriesMatchingFiltersFromFile", false, 0, null, INFO_LDAPDELETE_ARG_DESC_DELETE_ENTRIES_MATCHING_FILTER_FILE.get(), true, true, true, false);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("delete-entries-matching-filters-from-file", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("deleteEntriesMatchingFilterFromFile", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("delete-entries-matching-filter-from-file", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("deleteFilterFile", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("delete-filter-file", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("deleteSearchFilterFile", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("delete-search-filter-file", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("filterFile", true);
deleteEntriesMatchingFiltersFromFile.addLongIdentifier("filter-file", true);
deleteEntriesMatchingFiltersFromFile.setArgumentGroupName(argGroupData);
parser.addArgument(deleteEntriesMatchingFiltersFromFile);
searchBaseDN = new DNArgument(null, "searchBaseDN", false, 0, null, INFO_LDAPDELETE_ARG_DESC_SEARCH_BASE_DN.get(), DN.NULL_DN);
searchBaseDN.addLongIdentifier("search-base-dn", true);
searchBaseDN.addLongIdentifier("baseDN", true);
searchBaseDN.addLongIdentifier("base-dn", true);
searchBaseDN.setArgumentGroupName(argGroupData);
parser.addArgument(searchBaseDN);
searchPageSize = new IntegerArgument(null, "searchPageSize", false, 1, null, INFO_LDAPDELETE_ARG_DESC_SEARCH_PAGE_SIZE.get(), 1, Integer.MAX_VALUE);
searchPageSize.addLongIdentifier("search-page-size", true);
searchPageSize.addLongIdentifier("simplePagedResultsPageSize", true);
searchPageSize.addLongIdentifier("simple-paged-results-page-size", true);
searchPageSize.addLongIdentifier("pageSize", true);
searchPageSize.addLongIdentifier("page-size", true);
searchPageSize.setArgumentGroupName(argGroupData);
parser.addArgument(searchPageSize);
encryptionPassphraseFile = new FileArgument(null, "encryptionPassphraseFile", false, 1, null, INFO_LDAPDELETE_ARG_DESC_ENCRYPTION_PW_FILE.get(), true, true, true, false);
encryptionPassphraseFile.addLongIdentifier("encryption-passphrase-file", true);
encryptionPassphraseFile.addLongIdentifier("encryptionPasswordFile", true);
encryptionPassphraseFile.addLongIdentifier("encryption-password-file", true);
encryptionPassphraseFile.addLongIdentifier("encryptionPINFile", true);
encryptionPassphraseFile.addLongIdentifier("encryption-pin-file", true);
encryptionPassphraseFile.setArgumentGroupName(argGroupData);
parser.addArgument(encryptionPassphraseFile);
characterSet = new StringArgument('i', "characterSet", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_CHARSET.get(), INFO_LDAPDELETE_ARG_DESC_CHARSET.get(), "UTF-8");
characterSet.addLongIdentifier("character-set", true);
characterSet.addLongIdentifier("charSet", true);
characterSet.addLongIdentifier("char-set", true);
characterSet.addLongIdentifier("encoding", true);
characterSet.setArgumentGroupName(argGroupData);
parser.addArgument(characterSet);
rejectFile = new FileArgument('R', "rejectFile", false, 1, null, INFO_LDAPDELETE_ARG_DESC_REJECT_FILE.get(), false, true, true, false);
rejectFile.addLongIdentifier("reject-file", true);
rejectFile.addLongIdentifier("errorFile", true);
rejectFile.addLongIdentifier("error-file", true);
rejectFile.addLongIdentifier("failureFile", true);
rejectFile.addLongIdentifier("failure-file", true);
rejectFile.setArgumentGroupName(argGroupData);
parser.addArgument(rejectFile);
verbose = new BooleanArgument('v', "verbose", 1, INFO_LDAPDELETE_ARG_DESC_VERBOSE.get());
verbose.setArgumentGroupName(argGroupData);
parser.addArgument(verbose);
// This argument has no effect. It is provided for compatibility with a
// legacy ldapdelete tool, where the argument was also offered but had no
// effect. In this tool, it is hidden.
final BooleanArgument scriptFriendly = new BooleanArgument(null, "scriptFriendly", 1, INFO_LDAPDELETE_ARG_DESC_SCRIPT_FRIENDLY.get());
scriptFriendly.addLongIdentifier("script-friendly", true);
scriptFriendly.setArgumentGroupName(argGroupData);
scriptFriendly.setHidden(true);
parser.addArgument(scriptFriendly);
//
// Operation Arguments
//
final String argGroupOp = INFO_LDAPDELETE_ARG_GROUP_OPERATION.get();
// NOTE: The retryFailedOperations argument is now hidden, as we will retry
// operations by default. The neverRetry argument can be used to disable
// this.
retryFailedOperations = new BooleanArgument(null, "retryFailedOperations", 1, INFO_LDAPDELETE_ARG_DESC_RETRY_FAILED_OPS.get());
retryFailedOperations.addLongIdentifier("retry-failed-operations", true);
retryFailedOperations.addLongIdentifier("retryFailedOps", true);
retryFailedOperations.addLongIdentifier("retry-failed-ops", true);
retryFailedOperations.addLongIdentifier("retry", true);
retryFailedOperations.setArgumentGroupName(argGroupOp);
retryFailedOperations.setHidden(true);
parser.addArgument(retryFailedOperations);
neverRetry = new BooleanArgument(null, "neverRetry", 1, INFO_LDAPDELETE_ARG_DESC_NEVER_RETRY.get());
neverRetry.addLongIdentifier("never-retry", true);
neverRetry.setArgumentGroupName(argGroupOp);
parser.addArgument(neverRetry);
dryRun = new BooleanArgument('n', "dryRun", 1, INFO_LDAPDELETE_ARG_DESC_DRY_RUN.get());
dryRun.addLongIdentifier("dry-run", true);
dryRun.setArgumentGroupName(argGroupOp);
parser.addArgument(dryRun);
continueOnError = new BooleanArgument('c', "continueOnError", 1, INFO_LDAPDELETE_ARG_DESC_CONTINUE_ON_ERROR.get());
continueOnError.addLongIdentifier("continue-on-error", true);
continueOnError.setArgumentGroupName(argGroupOp);
parser.addArgument(continueOnError);
followReferrals = new BooleanArgument(null, "followReferrals", 1, INFO_LDAPDELETE_ARG_DESC_FOLLOW_REFERRALS.get());
followReferrals.addLongIdentifier("follow-referrals", true);
followReferrals.setArgumentGroupName(argGroupOp);
parser.addArgument(followReferrals);
useAdministrativeSession = new BooleanArgument(null, "useAdministrativeSession", 1, INFO_LDAPDELETE_ARG_DESC_USE_ADMIN_SESSION.get());
useAdministrativeSession.addLongIdentifier("use-administrative-session", true);
useAdministrativeSession.addLongIdentifier("useAdminSession", true);
useAdministrativeSession.addLongIdentifier("use-admin-session", true);
useAdministrativeSession.setArgumentGroupName(argGroupOp);
parser.addArgument(useAdministrativeSession);
ratePerSecond = new IntegerArgument('r', "ratePerSecond", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_RATE_PER_SECOND.get(), INFO_LDAPDELETE_ARG_DESC_RATE_PER_SECOND.get(), 1, Integer.MAX_VALUE);
ratePerSecond.addLongIdentifier("rate-per-second", true);
ratePerSecond.addLongIdentifier("deletesPerSecond", true);
ratePerSecond.addLongIdentifier("deletes-per-second", true);
ratePerSecond.addLongIdentifier("operationsPerSecond", true);
ratePerSecond.addLongIdentifier("operations-per-second", true);
ratePerSecond.addLongIdentifier("opsPerSecond", true);
ratePerSecond.addLongIdentifier("ops-per-second", true);
ratePerSecond.setArgumentGroupName(argGroupOp);
parser.addArgument(ratePerSecond);
// This argument has no effect. It is provided for compatibility with a
// legacy ldapdelete tool, but this version only supports LDAPv3, so this
// argument is hidden.
final IntegerArgument ldapVersion = new IntegerArgument('V', "ldapVersion", false, 1, "{version}", INFO_LDAPDELETE_ARG_DESC_LDAP_VERSION.get(), 3, 3, 3);
ldapVersion.addLongIdentifier("ldap-version", true);
ldapVersion.setArgumentGroupName(argGroupOp);
ldapVersion.setHidden(true);
parser.addArgument(ldapVersion);
//
// Control Arguments
//
final String argGroupControls = INFO_LDAPDELETE_ARG_GROUP_CONTROLS.get();
clientSideSubtreeDelete = new BooleanArgument(null, "clientSideSubtreeDelete", 1, INFO_LDAPDELETE_ARG_DESC_CLIENT_SIDE_SUB_DEL.get());
clientSideSubtreeDelete.addLongIdentifier("client-side-subtree-delete", true);
clientSideSubtreeDelete.setArgumentGroupName(argGroupControls);
parser.addArgument(clientSideSubtreeDelete);
serverSideSubtreeDelete = new BooleanArgument('x', "serverSideSubtreeDelete", 1, INFO_LDAPDELETE_ARG_DESC_SERVER_SIDE_SUB_DEL.get());
serverSideSubtreeDelete.addLongIdentifier("server-side-subtree-delete", true);
serverSideSubtreeDelete.addLongIdentifier("deleteSubtree", true);
serverSideSubtreeDelete.addLongIdentifier("delete-subtree", true);
serverSideSubtreeDelete.addLongIdentifier("useSubtreeDeleteControl", true);
serverSideSubtreeDelete.addLongIdentifier("use-subtree-delete-control", true);
serverSideSubtreeDelete.setArgumentGroupName(argGroupControls);
parser.addArgument(serverSideSubtreeDelete);
softDelete = new BooleanArgument('s', "softDelete", 1, INFO_LDAPDELETE_ARG_DESC_SOFT_DELETE.get());
softDelete.addLongIdentifier("soft-delete", true);
softDelete.addLongIdentifier("useSoftDelete", true);
softDelete.addLongIdentifier("use-soft-delete", true);
softDelete.addLongIdentifier("useSoftDeleteControl", true);
softDelete.addLongIdentifier("use-soft-delete-control", true);
softDelete.setArgumentGroupName(argGroupControls);
parser.addArgument(softDelete);
hardDelete = new BooleanArgument(null, "hardDelete", 1, INFO_LDAPDELETE_ARG_DESC_HARD_DELETE.get());
hardDelete.addLongIdentifier("hard-delete", true);
hardDelete.addLongIdentifier("useHardDelete", true);
hardDelete.addLongIdentifier("use-hard-delete", true);
hardDelete.addLongIdentifier("useHardDeleteControl", true);
hardDelete.addLongIdentifier("use-hard-delete-control", true);
hardDelete.setArgumentGroupName(argGroupControls);
parser.addArgument(hardDelete);
proxyAs = new StringArgument('Y', "proxyAs", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_AUTHZ_ID.get(), INFO_LDAPDELETE_ARG_DESC_PROXY_AS.get());
proxyAs.addLongIdentifier("proxy-as", true);
proxyAs.addLongIdentifier("proxyV2As", true);
proxyAs.addLongIdentifier("proxy-v2-as", true);
proxyAs.addLongIdentifier("proxiedAuth", true);
proxyAs.addLongIdentifier("proxied-auth", true);
proxyAs.addLongIdentifier("proxiedAuthorization", true);
proxyAs.addLongIdentifier("proxied-authorization", true);
proxyAs.addLongIdentifier("useProxiedAuth", true);
proxyAs.addLongIdentifier("use-proxied-auth", true);
proxyAs.addLongIdentifier("useProxiedAuthorization", true);
proxyAs.addLongIdentifier("use-proxied-authorization", true);
proxyAs.addLongIdentifier("useProxiedAuthControl", true);
proxyAs.addLongIdentifier("use-proxied-auth-control", true);
proxyAs.addLongIdentifier("useProxiedAuthorizationControl", true);
proxyAs.addLongIdentifier("use-proxied-authorization-control", true);
proxyAs.setArgumentGroupName(argGroupControls);
parser.addArgument(proxyAs);
proxyV1As = new DNArgument(null, "proxyV1As", false, 1, null, INFO_LDAPDELETE_ARG_DESC_PROXY_V1_AS.get());
proxyV1As.addLongIdentifier("proxy-v1-as", true);
proxyV1As.setArgumentGroupName(argGroupControls);
parser.addArgument(proxyV1As);
manageDsaIT = new BooleanArgument(null, "useManageDsaIT", 1, INFO_LDAPDELETE_ARG_DESC_MANAGE_DSA_IT.get());
manageDsaIT.addLongIdentifier("use-manage-dsa-it", true);
manageDsaIT.addLongIdentifier("manageDsaIT", true);
manageDsaIT.addLongIdentifier("manage-dsa-it", true);
manageDsaIT.addLongIdentifier("manageDsaITControl", true);
manageDsaIT.addLongIdentifier("manage-dsa-it-control", true);
manageDsaIT.addLongIdentifier("useManageDsaITControl", true);
manageDsaIT.addLongIdentifier("use-manage-dsa-it-control", true);
manageDsaIT.setArgumentGroupName(argGroupControls);
parser.addArgument(manageDsaIT);
assertionFilter = new FilterArgument(null, "assertionFilter", false, 1, null, INFO_LDAPDELETE_ARG_DESC_ASSERTION_FILTER.get());
assertionFilter.addLongIdentifier("assertion-filter", true);
assertionFilter.addLongIdentifier("useAssertionFilter", true);
assertionFilter.addLongIdentifier("use-assertion-filter", true);
assertionFilter.addLongIdentifier("assertionControl", true);
assertionFilter.addLongIdentifier("assertion-control", true);
assertionFilter.addLongIdentifier("useAssertionControl", true);
assertionFilter.addLongIdentifier("use-assertion-control", true);
assertionFilter.setArgumentGroupName(argGroupControls);
parser.addArgument(assertionFilter);
preReadAttribute = new StringArgument(null, "preReadAttribute", false, 0, INFO_LDAPDELETE_ARG_PLACEHOLDER_ATTR.get(), INFO_LDAPDELETE_ARG_DESC_PRE_READ_ATTR.get());
preReadAttribute.addLongIdentifier("pre-read-attribute", true);
preReadAttribute.setArgumentGroupName(argGroupControls);
parser.addArgument(preReadAttribute);
noOperation = new BooleanArgument(null, "noOperation", 1, INFO_LDAPDELETE_ARG_DESC_NO_OP.get());
noOperation.addLongIdentifier("no-operation", true);
noOperation.addLongIdentifier("noOp", true);
noOperation.addLongIdentifier("no-op", true);
noOperation.setArgumentGroupName(argGroupControls);
parser.addArgument(noOperation);
getBackendSetID = new BooleanArgument(null, "getBackendSetID", 1, INFO_LDAPDELETE_ARG_DESC_GET_BACKEND_SET_ID.get());
getBackendSetID.addLongIdentifier("get-backend-set-id", true);
getBackendSetID.addLongIdentifier("useGetBackendSetID", true);
getBackendSetID.addLongIdentifier("use-get-backend-set-id", true);
getBackendSetID.addLongIdentifier("useGetBackendSetIDControl", true);
getBackendSetID.addLongIdentifier("use-get-backend-set-id-control", true);
getBackendSetID.setArgumentGroupName(argGroupControls);
parser.addArgument(getBackendSetID);
routeToBackendSet = new StringArgument(null, "routeToBackendSet", false, 0, INFO_LDAPDELETE_ARG_PLACEHOLDER_ROUTE_TO_BACKEND_SET.get(), INFO_LDAPDELETE_ARG_DESC_ROUTE_TO_BACKEND_SET.get());
routeToBackendSet.addLongIdentifier("route-to-backend-set", true);
routeToBackendSet.addLongIdentifier("useRouteToBackendSet", true);
routeToBackendSet.addLongIdentifier("use0route-to-backend-set", true);
routeToBackendSet.addLongIdentifier("useRouteToBackendSetControl", true);
routeToBackendSet.addLongIdentifier("use-route-to-backend-set-control", true);
routeToBackendSet.setArgumentGroupName(argGroupControls);
parser.addArgument(routeToBackendSet);
getServerID = new BooleanArgument(null, "getServerID", 1, INFO_LDAPDELETE_ARG_DESC_GET_SERVER_ID.get());
getServerID.addLongIdentifier("get-server-id", true);
getServerID.addLongIdentifier("getBackendServerID", true);
getServerID.addLongIdentifier("get-backend-server-id", true);
getServerID.addLongIdentifier("useGetServerID", true);
getServerID.addLongIdentifier("use-get-server-id", true);
getServerID.addLongIdentifier("useGetServerIDControl", true);
getServerID.addLongIdentifier("use-get-server-id-control", true);
getServerID.setArgumentGroupName(argGroupControls);
parser.addArgument(getServerID);
routeToServer = new StringArgument(null, "routeToServer", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_ID.get(), INFO_LDAPDELETE_ARG_DESC_ROUTE_TO_SERVER.get());
routeToServer.addLongIdentifier("route-to-server", true);
routeToServer.addLongIdentifier("routeToBackendServer", true);
routeToServer.addLongIdentifier("route-to-backend-server", true);
routeToServer.addLongIdentifier("useRouteToServer", true);
routeToServer.addLongIdentifier("use-route-to-server", true);
routeToServer.addLongIdentifier("useRouteToBackendServer", true);
routeToServer.addLongIdentifier("use-route-to-backend-server", true);
routeToServer.addLongIdentifier("useRouteToServerControl", true);
routeToServer.addLongIdentifier("use-route-to-server-control", true);
routeToServer.addLongIdentifier("useRouteToBackendServerControl", true);
routeToServer.addLongIdentifier("use-route-to-backend-server-control", true);
routeToServer.setArgumentGroupName(argGroupControls);
parser.addArgument(routeToServer);
useAssuredReplication = new BooleanArgument(null, "useAssuredReplication", 1, INFO_LDAPDELETE_ARG_DESC_USE_ASSURED_REPLICATION.get());
useAssuredReplication.addLongIdentifier("use-assured-replication", true);
useAssuredReplication.addLongIdentifier("assuredReplication", true);
useAssuredReplication.addLongIdentifier("assured-replication", true);
useAssuredReplication.addLongIdentifier("assuredReplicationControl", true);
useAssuredReplication.addLongIdentifier("assured-replication-control", true);
useAssuredReplication.addLongIdentifier("useAssuredReplicationControl", true);
useAssuredReplication.addLongIdentifier("use-assured-replication-control", true);
useAssuredReplication.setArgumentGroupName(argGroupControls);
parser.addArgument(useAssuredReplication);
assuredReplicationLocalLevel = new StringArgument(null, "assuredReplicationLocalLevel", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_ASSURED_REPLICATION_LOCAL_LEVEL.get(), INFO_LDAPDELETE_ARG_DESC_ASSURED_REPLICATION_LOCAL_LEVEL.get(), StaticUtils.setOf("none", "received-any-server", "processed-all-servers"));
assuredReplicationLocalLevel.addLongIdentifier("assured-replication-local-level", true);
assuredReplicationLocalLevel.setArgumentGroupName(argGroupControls);
parser.addArgument(assuredReplicationLocalLevel);
assuredReplicationRemoteLevel = new StringArgument(null, "assuredReplicationRemoteLevel", false, 1, INFO_LDAPDELETE_ARG_PLACEHOLDER_ASSURED_REPLICATION_REMOTE_LEVEL.get(), INFO_LDAPDELETE_ARG_DESC_ASSURED_REPLICATION_REMOTE_LEVEL.get(), StaticUtils.setOf("none", "received-any-remote-location", "received-all-remote-locations", "processed-all-remote-servers"));
assuredReplicationRemoteLevel.addLongIdentifier("assured-replication-remote-level", true);
assuredReplicationRemoteLevel.setArgumentGroupName(argGroupControls);
parser.addArgument(assuredReplicationRemoteLevel);
assuredReplicationTimeout = new DurationArgument(null, "assuredReplicationTimeout", false, null, INFO_LDAPDELETE_ARG_DESC_ASSURED_REPLICATION_TIMEOUT.get());
assuredReplicationTimeout.addLongIdentifier("assured-replication-timeout", true);
assuredReplicationTimeout.setArgumentGroupName(argGroupControls);
parser.addArgument(assuredReplicationTimeout);
replicationRepair = new BooleanArgument(null, "replicationRepair", 1, INFO_LDAPDELETE_ARG_DESC_REPLICATION_REPAIR.get());
replicationRepair.addLongIdentifier("replication-repair", true);
replicationRepair.addLongIdentifier("replicationRepairControl", true);
replicationRepair.addLongIdentifier("replication-repair-control", true);
replicationRepair.addLongIdentifier("useReplicationRepair", true);
replicationRepair.addLongIdentifier("use-replication-repair", true);
replicationRepair.addLongIdentifier("useReplicationRepairControl", true);
replicationRepair.addLongIdentifier("use-replication-repair-control", true);
replicationRepair.setArgumentGroupName(argGroupControls);
parser.addArgument(replicationRepair);
suppressReferentialIntegrityUpdates = new BooleanArgument(null, "suppressReferentialIntegrityUpdates", 1, INFO_LDAPDELETE_ARG_DESC_SUPPRESS_REFINT_UPDATES.get());
suppressReferentialIntegrityUpdates.addLongIdentifier("suppress-referential-integrity-updates", true);
suppressReferentialIntegrityUpdates.addLongIdentifier("useSuppressReferentialIntegrityUpdates", true);
suppressReferentialIntegrityUpdates.addLongIdentifier("use-suppress-referential-integrity-updates", true);
suppressReferentialIntegrityUpdates.addLongIdentifier("useSuppressReferentialIntegrityUpdatesControl", true);
suppressReferentialIntegrityUpdates.addLongIdentifier("use-suppress-referential-integrity-updates-control", true);
suppressReferentialIntegrityUpdates.setArgumentGroupName(argGroupControls);
parser.addArgument(suppressReferentialIntegrityUpdates);
operationPurpose = new StringArgument(null, "operationPurpose", false, 1, null, INFO_LDAPDELETE_ARG_DESC_OP_PURPOSE.get());
operationPurpose.addLongIdentifier("operation-purpose", true);
operationPurpose.addLongIdentifier("operationPurposeControl", true);
operationPurpose.addLongIdentifier("operation-purpose-control", true);
operationPurpose.addLongIdentifier("useOperationPurpose", true);
operationPurpose.addLongIdentifier("use-operation-purpose", true);
operationPurpose.addLongIdentifier("useOperationPurposeControl", true);
operationPurpose.addLongIdentifier("use-operation-purpose-control", true);
operationPurpose.setArgumentGroupName(argGroupControls);
parser.addArgument(operationPurpose);
authorizationIdentity = new BooleanArgument('E', "authorizationIdentity", 1, INFO_LDAPDELETE_ARG_DESC_AUTHZ_ID.get());
authorizationIdentity.addLongIdentifier("authorization-identity", true);
authorizationIdentity.addLongIdentifier("useAuthorizationIdentity", true);
authorizationIdentity.addLongIdentifier("use-authorization-identity", true);
authorizationIdentity.addLongIdentifier("useAuthorizationIdentityControl", true);
authorizationIdentity.addLongIdentifier("use-authorization-identity-control", true);
authorizationIdentity.setArgumentGroupName(argGroupControls);
parser.addArgument(authorizationIdentity);
getAuthorizationEntryAttribute = new StringArgument(null, "getAuthorizationEntryAttribute", false, 0, INFO_LDAPDELETE_ARG_PLACEHOLDER_ATTR.get(), INFO_LDAPDELETE_ARG_DESC_GET_AUTHZ_ENTRY_ATTR.get());
getAuthorizationEntryAttribute.addLongIdentifier("get-authorization-entry-attribute", true);
getAuthorizationEntryAttribute.setArgumentGroupName(argGroupControls);
parser.addArgument(getAuthorizationEntryAttribute);
getUserResourceLimits = new BooleanArgument(null, "getUserResourceLimits", 1, INFO_LDAPDELETE_ARG_DESC_GET_USER_RESOURCE_LIMITS.get());
getUserResourceLimits.addLongIdentifier("get-user-resource-limits", true);
getUserResourceLimits.addLongIdentifier("getUserResourceLimitsControl", true);
getUserResourceLimits.addLongIdentifier("get-user-resource-limits-control", true);
getUserResourceLimits.addLongIdentifier("useGetUserResourceLimits", true);
getUserResourceLimits.addLongIdentifier("use-get-user-resource-limits", true);
getUserResourceLimits.addLongIdentifier("useGetUserResourceLimitsControl", true);
getUserResourceLimits.addLongIdentifier("use-get-user-resource-limits-control", true);
getUserResourceLimits.setArgumentGroupName(argGroupControls);
parser.addArgument(getUserResourceLimits);
deleteControl = new ControlArgument('J', "deleteControl", false, 0, null, INFO_LDAPDELETE_ARG_DESC_DELETE_CONTROL.get());
deleteControl.addLongIdentifier("delete-control", true);
deleteControl.addLongIdentifier("operationControl", true);
deleteControl.addLongIdentifier("operation-control", true);
deleteControl.addLongIdentifier("control", true);
deleteControl.setArgumentGroupName(argGroupControls);
parser.addArgument(deleteControl);
bindControl = new ControlArgument(null, "bindControl", false, 0, null, INFO_LDAPDELETE_ARG_DESC_BIND_CONTROL.get());
bindControl.addLongIdentifier("bind-control", true);
bindControl.setArgumentGroupName(argGroupControls);
parser.addArgument(bindControl);
//
// Argument Constraints
//
// At most one argument may be provided to select the entries to delete.
parser.addExclusiveArgumentSet(entryDN, dnFile, deleteEntriesMatchingFilter, deleteEntriesMatchingFiltersFromFile);
// The searchBaseDN argument can only be used if identifying entries with
// search filters.
parser.addDependentArgumentSet(searchBaseDN, deleteEntriesMatchingFilter, deleteEntriesMatchingFiltersFromFile);
// The search page size argument can only be used if identifying entries
// with search filters or performing a client-side subtree delete.
parser.addDependentArgumentSet(searchPageSize, deleteEntriesMatchingFilter, deleteEntriesMatchingFiltersFromFile, clientSideSubtreeDelete);
// Follow referrals and manage DSA IT can't be used together.
parser.addExclusiveArgumentSet(followReferrals, manageDsaIT);
// Client-side and server-side subtree delete can't be used together.
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, serverSideSubtreeDelete);
// A lot of options can't be used in conjunction with client-side
// subtree delete.
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, followReferrals);
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, preReadAttribute);
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, getBackendSetID);
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, getServerID);
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, noOperation);
parser.addExclusiveArgumentSet(clientSideSubtreeDelete, dryRun);
// Soft delete and hard delete can't be used together.
parser.addExclusiveArgumentSet(softDelete, hardDelete);
}
Aggregations