Search in sources :

Example 21 with IntegerArgument

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

the class LDIFSearch method addToolArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    this.parser = parser;
    ldifFile = new FileArgument('l', "ldifFile", true, 0, null, INFO_LDIFSEARCH_ARG_DESC_LDIF_FILE.get(), true, true, true, false);
    ldifFile.addLongIdentifier("ldif-file", true);
    ldifFile.addLongIdentifier("inputFile", true);
    ldifFile.addLongIdentifier("input-file", true);
    ldifFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    parser.addArgument(ldifFile);
    final String ldifPWDesc;
    if (PING_SERVER_AVAILABLE) {
        ldifPWDesc = INFO_LDIFSEARCH_ARG_DESC_LDIF_PW_FILE_PING_SERVER.get();
    } else {
        ldifPWDesc = INFO_LDIFSEARCH_ARG_DESC_LDIF_PW_FILE_STANDALONE.get();
    }
    ldifEncryptionPassphraseFile = new FileArgument(null, "ldifEncryptionPassphraseFile", false, 1, null, ldifPWDesc, true, true, true, false);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldif-encryption-passphrase-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldifPassphraseFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldif-passphrase-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldifEncryptionPasswordFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldif-encryption-password-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldifPasswordFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("ldif-password-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("inputEncryptionPassphraseFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("input-encryption-passphrase-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("inputPassphraseFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("input-passphrase-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("inputEncryptionPasswordFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("input-encryption-password-file", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("inputPasswordFile", true);
    ldifEncryptionPassphraseFile.addLongIdentifier("input-password-file", true);
    ldifEncryptionPassphraseFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    parser.addArgument(ldifEncryptionPassphraseFile);
    stripTrailingSpaces = new BooleanArgument(null, "stripTrailingSpaces", 1, INFO_LDIFSEARCH_ARG_DESC_STRIP_TRAILING_SPACES.get());
    stripTrailingSpaces.addLongIdentifier("strip-trailing-spaces", true);
    stripTrailingSpaces.addLongIdentifier("ignoreTrailingSpaces", true);
    stripTrailingSpaces.addLongIdentifier("ignore-trailing-spaces", true);
    stripTrailingSpaces.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    parser.addArgument(stripTrailingSpaces);
    final String schemaPathDesc;
    if (PING_SERVER_AVAILABLE) {
        schemaPathDesc = INFO_LDIFSEARCH_ARG_DESC_SCHEMA_PATH_PING_SERVER.get();
    } else {
        schemaPathDesc = INFO_LDIFSEARCH_ARG_DESC_SCHEMA_PATH_STANDALONE.get();
    }
    schemaPath = new FileArgument(null, "schemaPath", false, 0, null, schemaPathDesc, true, true, false, false);
    schemaPath.addLongIdentifier("schema-path", true);
    schemaPath.addLongIdentifier("schemaFile", true);
    schemaPath.addLongIdentifier("schema-file", true);
    schemaPath.addLongIdentifier("schemaDirectory", true);
    schemaPath.addLongIdentifier("schema-directory", true);
    schemaPath.addLongIdentifier("schema", true);
    schemaPath.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    parser.addArgument(schemaPath);
    checkSchema = new BooleanArgument(null, "checkSchema", 1, INFO_LDIFSEARCH_ARG_DESC_CHECK_SCHEMA.get());
    checkSchema.addLongIdentifier("check-schema", true);
    checkSchema.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    parser.addArgument(checkSchema);
    isCompressed = new BooleanArgument(null, "isCompressed", 1, INFO_LDIFSEARCH_ARG_DESC_IS_COMPRESSED.get());
    isCompressed.addLongIdentifier("is-compressed", true);
    isCompressed.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_INPUT.get());
    isCompressed.setHidden(true);
    parser.addArgument(isCompressed);
    outputFile = new FileArgument('o', "outputFile", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_OUTPUT_FILE.get(), false, true, true, false);
    outputFile.addLongIdentifier("output-file", true);
    outputFile.addLongIdentifier("outputLDIF", true);
    outputFile.addLongIdentifier("output-ldif", true);
    outputFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(outputFile);
    separateOutputFilePerSearch = new BooleanArgument(null, "separateOutputFilePerSearch", 1, INFO_LDIFSEARCH_ARG_DESC_SEPARATE_OUTPUT_FILES.get());
    separateOutputFilePerSearch.addLongIdentifier("separate-output-file-per-search", true);
    separateOutputFilePerSearch.addLongIdentifier("separateOutputFiles", true);
    separateOutputFilePerSearch.addLongIdentifier("separate-output-files", true);
    separateOutputFilePerSearch.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(separateOutputFilePerSearch);
    compressOutput = new BooleanArgument(null, "compressOutput", 1, INFO_LDIFSEARCH_ARG_DESC_COMPRESS_OUTPUT.get());
    compressOutput.addLongIdentifier("compress-output", true);
    compressOutput.addLongIdentifier("compressLDIF", true);
    compressOutput.addLongIdentifier("compress-ldif", true);
    compressOutput.addLongIdentifier("compress", true);
    compressOutput.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(compressOutput);
    encryptOutput = new BooleanArgument(null, "encryptOutput", 1, INFO_LDIFSEARCH_ARG_DESC_ENCRYPT_OUTPUT.get());
    encryptOutput.addLongIdentifier("encrypt-output", true);
    encryptOutput.addLongIdentifier("encryptLDIF", true);
    encryptOutput.addLongIdentifier("encrypt-ldif", true);
    encryptOutput.addLongIdentifier("encrypt", true);
    encryptOutput.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(encryptOutput);
    outputEncryptionPassphraseFile = new FileArgument(null, "outputEncryptionPassphraseFile", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_OUTPUT_PW_FILE.get(), true, true, true, false);
    outputEncryptionPassphraseFile.addLongIdentifier("output-encryption-passphrase-file", true);
    outputEncryptionPassphraseFile.addLongIdentifier("outputPassphraseFile", true);
    outputEncryptionPassphraseFile.addLongIdentifier("output-passphrase-file", true);
    outputEncryptionPassphraseFile.addLongIdentifier("outputEncryptionPasswordFile", true);
    outputEncryptionPassphraseFile.addLongIdentifier("output-encryption-password-file", true);
    outputEncryptionPassphraseFile.addLongIdentifier("outputPasswordFile", true);
    outputEncryptionPassphraseFile.addLongIdentifier("output-password-file", true);
    outputEncryptionPassphraseFile.addLongIdentifier("outputEncryptionPasswordFile", true);
    outputEncryptionPassphraseFile.addLongIdentifier("output-encryption-password-file", true);
    outputEncryptionPassphraseFile.addLongIdentifier("outputPasswordFile", true);
    outputEncryptionPassphraseFile.addLongIdentifier("output-password-file", true);
    outputEncryptionPassphraseFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(outputEncryptionPassphraseFile);
    overwriteExistingOutputFile = new BooleanArgument('O', "overwriteExistingOutputFile", 1, INFO_LDIFSEARCH_ARG_DESC_OVERWRITE_EXISTING.get());
    overwriteExistingOutputFile.addLongIdentifier("overwrite-existing-output-file", true);
    overwriteExistingOutputFile.addLongIdentifier("overwriteExistingOutputFiles", true);
    overwriteExistingOutputFile.addLongIdentifier("overwrite-existing-output-files", true);
    overwriteExistingOutputFile.addLongIdentifier("overwriteExistingOutput", true);
    overwriteExistingOutputFile.addLongIdentifier("overwrite-existing-output", true);
    overwriteExistingOutputFile.addLongIdentifier("overwriteExisting", true);
    overwriteExistingOutputFile.addLongIdentifier("overwrite-existing", true);
    overwriteExistingOutputFile.addLongIdentifier("overwrite", true);
    overwriteExistingOutputFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(overwriteExistingOutputFile);
    final Set<String> outputFormatAllowedValues = StaticUtils.setOf("ldif", "json", "csv", "multi-valued-csv", "tab-delimited", "multi-valued-tab-delimited", "dns-only", "values-only");
    outputFormat = new StringArgument(null, "outputFormat", false, 1, "{ldif|json|csv|multi-valued-csv|tab-delimited|" + "multi-valued-tab-delimited|dns-only|values-only}", INFO_LDIFSEARCH_ARG_DESC_OUTPUT_FORMAT.get(), outputFormatAllowedValues, "ldif");
    outputFormat.addLongIdentifier("output-format", true);
    outputFormat.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(outputFormat);
    wrapColumn = new IntegerArgument(null, "wrapColumn", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_WRAP_COLUMN.get(), 5, Integer.MAX_VALUE);
    wrapColumn.addLongIdentifier("wrap-column", true);
    wrapColumn.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(wrapColumn);
    doNotWrap = new BooleanArgument('T', "doNotWrap", 1, INFO_LDIFSEARCH_ARG_DESC_DO_NOT_WRAP.get());
    doNotWrap.addLongIdentifier("do-not-wrap", true);
    doNotWrap.addLongIdentifier("dontWrap", true);
    doNotWrap.addLongIdentifier("dont-wrap", true);
    doNotWrap.addLongIdentifier("noWrap", true);
    doNotWrap.addLongIdentifier("no-wrap", true);
    doNotWrap.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_OUTPUT.get());
    parser.addArgument(doNotWrap);
    baseDN = new DNArgument('b', "baseDN", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_BASE_DN.get());
    baseDN.addLongIdentifier("base-dn", true);
    baseDN.addLongIdentifier("searchBaseDN", true);
    baseDN.addLongIdentifier("search-base-dn", true);
    baseDN.addLongIdentifier("searchBase", true);
    baseDN.addLongIdentifier("search-base", true);
    baseDN.addLongIdentifier("base", true);
    baseDN.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    parser.addArgument(baseDN);
    scope = new ScopeArgument('s', "scope", false, null, INFO_LDIFSEARCH_ARG_DESC_SCOPE.get());
    scope.addLongIdentifier("searchScope", true);
    scope.addLongIdentifier("search-scope", true);
    scope.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    parser.addArgument(scope);
    filterFile = new FileArgument('f', "filterFile", false, 0, null, INFO_LDIFSEARCH_ARG_DESC_FILTER_FILE.get(), true, true, true, false);
    filterFile.addLongIdentifier("filter-file", true);
    filterFile.addLongIdentifier("filtersFile", true);
    filterFile.addLongIdentifier("filters-file", true);
    filterFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    parser.addArgument(filterFile);
    ldapURLFile = new FileArgument(null, "ldapURLFile", false, 0, null, INFO_LDIFSEARCH_ARG_DESC_LDAP_URL_FILE.get(), true, true, true, false);
    ldapURLFile.addLongIdentifier("ldap-url-file", true);
    ldapURLFile.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    parser.addArgument(ldapURLFile);
    sizeLimit = new IntegerArgument('z', "sizeLimit", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_SIZE_LIMIT.get(), 0, Integer.MAX_VALUE, 0);
    sizeLimit.addLongIdentifier("size-limit", true);
    sizeLimit.addLongIdentifier("searchSizeLimit", true);
    sizeLimit.addLongIdentifier("search-size-limit", true);
    sizeLimit.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    sizeLimit.setHidden(true);
    parser.addArgument(sizeLimit);
    timeLimitSeconds = new IntegerArgument('t', "timeLimitSeconds", false, 1, null, INFO_LDIFSEARCH_ARG_DESC_TIME_LIMIT_SECONDS.get(), 0, Integer.MAX_VALUE, 0);
    timeLimitSeconds.addLongIdentifier("time-limit-seconds", true);
    timeLimitSeconds.addLongIdentifier("timeLimit", true);
    timeLimitSeconds.setArgumentGroupName(INFO_LDIFSEARCH_ARG_GROUP_CRITERIA.get());
    timeLimitSeconds.setHidden(true);
    parser.addArgument(timeLimitSeconds);
    parser.addDependentArgumentSet(separateOutputFilePerSearch, outputFile);
    parser.addDependentArgumentSet(compressOutput, outputFile);
    parser.addDependentArgumentSet(encryptOutput, outputFile);
    parser.addDependentArgumentSet(overwriteExistingOutputFile, outputFile);
    parser.addDependentArgumentSet(outputEncryptionPassphraseFile, encryptOutput);
    parser.addExclusiveArgumentSet(wrapColumn, doNotWrap);
    parser.addExclusiveArgumentSet(baseDN, ldapURLFile);
    parser.addExclusiveArgumentSet(scope, ldapURLFile);
    parser.addExclusiveArgumentSet(filterFile, ldapURLFile);
    parser.addExclusiveArgumentSet(outputFormat, separateOutputFilePerSearch);
}
Also used : DNArgument(com.unboundid.util.args.DNArgument) 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 22 with IntegerArgument

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

the class MultiServerLDAPCommandLineTool method addToolArguments.

/**
 * {@inheritDoc}
 */
@Override()
public final void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    for (int i = 0; i < numServers; i++) {
        final StringBuilder groupNameBuffer = new StringBuilder();
        if (serverNamePrefixes != null) {
            final String prefix = serverNamePrefixes[i].replace('-', ' ').trim();
            groupNameBuffer.append(StaticUtils.capitalize(prefix, true));
        }
        if (serverNameSuffixes != null) {
            if (groupNameBuffer.length() > 0) {
                groupNameBuffer.append(' ');
            }
            final String suffix = serverNameSuffixes[i].replace('-', ' ').trim();
            groupNameBuffer.append(StaticUtils.capitalize(suffix, true));
        }
        groupNameBuffer.append(' ');
        groupNameBuffer.append(INFO_MULTI_LDAP_TOOL_GROUP_CONN_AND_AUTH.get());
        final String groupName = groupNameBuffer.toString();
        host[i] = new StringArgument(null, genArgName(i, "hostname"), true, 1, INFO_LDAP_TOOL_PLACEHOLDER_HOST.get(), INFO_LDAP_TOOL_DESCRIPTION_HOST.get(), "localhost");
        if (includeAlternateLongIdentifiers()) {
            host[i].addLongIdentifier(genDashedArgName(i, "hostname"), true);
            host[i].addLongIdentifier(genArgName(i, "host"), true);
            host[i].addLongIdentifier(genDashedArgName(i, "host"), true);
            host[i].addLongIdentifier(genArgName(i, "address"), true);
            host[i].addLongIdentifier(genDashedArgName(i, "address"), true);
        }
        host[i].setArgumentGroupName(groupName);
        parser.addArgument(host[i]);
        port[i] = new IntegerArgument(null, genArgName(i, "port"), true, 1, INFO_LDAP_TOOL_PLACEHOLDER_PORT.get(), INFO_LDAP_TOOL_DESCRIPTION_PORT.get(), 1, 65_535, 389);
        port[i].setArgumentGroupName(groupName);
        if (includeAlternateLongIdentifiers()) {
            port[i].addLongIdentifier(genDashedArgName(i, "port"), true);
        }
        parser.addArgument(port[i]);
        bindDN[i] = new DNArgument(null, genArgName(i, "bindDN"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_DN.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_DN.get());
        if (includeAlternateLongIdentifiers()) {
            bindDN[i].addLongIdentifier(genDashedArgName(i, "bind-dn"), true);
        }
        bindDN[i].setArgumentGroupName(groupName);
        parser.addArgument(bindDN[i]);
        bindPassword[i] = new StringArgument(null, genArgName(i, "bindPassword"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_PW.get());
        if (includeAlternateLongIdentifiers()) {
            bindPassword[i].addLongIdentifier(genDashedArgName(i, "bind-password"), true);
        }
        bindPassword[i].setSensitive(true);
        bindPassword[i].setArgumentGroupName(groupName);
        parser.addArgument(bindPassword[i]);
        bindPasswordFile[i] = new FileArgument(null, genArgName(i, "bindPasswordFile"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_PW_FILE.get(), true, true, true, false);
        if (includeAlternateLongIdentifiers()) {
            bindPasswordFile[i].addLongIdentifier(genDashedArgName(i, "bind-password-file"), true);
        }
        bindPasswordFile[i].setArgumentGroupName(groupName);
        parser.addArgument(bindPasswordFile[i]);
        useSSL[i] = new BooleanArgument(null, genArgName(i, "useSSL"), 1, INFO_LDAP_TOOL_DESCRIPTION_USE_SSL.get());
        if (includeAlternateLongIdentifiers()) {
            useSSL[i].addLongIdentifier(genDashedArgName(i, "use-ssl"), true);
        }
        useSSL[i].setArgumentGroupName(groupName);
        parser.addArgument(useSSL[i]);
        useStartTLS[i] = new BooleanArgument(null, genArgName(i, "useStartTLS"), 1, INFO_LDAP_TOOL_DESCRIPTION_USE_START_TLS.get());
        if (includeAlternateLongIdentifiers()) {
            useStartTLS[i].addLongIdentifier(genDashedArgName(i, "use-start-tls"), true);
        }
        useStartTLS[i].setArgumentGroupName(groupName);
        parser.addArgument(useStartTLS[i]);
        final String defaultTrustArgDesc;
        if (InternalSDKHelper.getPingIdentityServerRoot() != null) {
            defaultTrustArgDesc = INFO_LDAP_TOOL_DESCRIPTION_DEFAULT_TRUST_WITH_PING_DS.get();
        } else {
            defaultTrustArgDesc = INFO_LDAP_TOOL_DESCRIPTION_DEFAULT_TRUST_WITHOUT_PING_DS.get();
        }
        defaultTrust[i] = new BooleanArgument(null, genArgName(i, "defaultTrust"), 1, defaultTrustArgDesc);
        defaultTrust[i].setArgumentGroupName(groupName);
        if (includeAlternateLongIdentifiers()) {
            defaultTrust[i].addLongIdentifier(genDashedArgName(i, "default-trust"), true);
            defaultTrust[i].addLongIdentifier(genArgName(i, "useDefaultTrust"), true);
            defaultTrust[i].addLongIdentifier(genDashedArgName(i, "use-default-trust"), true);
        }
        parser.addArgument(defaultTrust[i]);
        trustAll[i] = new BooleanArgument(null, genArgName(i, "trustAll"), 1, INFO_LDAP_TOOL_DESCRIPTION_TRUST_ALL.get());
        if (includeAlternateLongIdentifiers()) {
            trustAll[i].addLongIdentifier(genDashedArgName(i, "trust-all"), true);
        }
        trustAll[i].setArgumentGroupName(groupName);
        parser.addArgument(trustAll[i]);
        keyStorePath[i] = new StringArgument(null, genArgName(i, "keyStorePath"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PATH.get());
        if (includeAlternateLongIdentifiers()) {
            keyStorePath[i].addLongIdentifier(genDashedArgName(i, "key-store-path"), true);
        }
        keyStorePath[i].setArgumentGroupName(groupName);
        parser.addArgument(keyStorePath[i]);
        keyStorePassword[i] = new StringArgument(null, genArgName(i, "keyStorePassword"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PASSWORD.get());
        if (includeAlternateLongIdentifiers()) {
            keyStorePassword[i].addLongIdentifier(genDashedArgName(i, "key-store-password"), true);
        }
        keyStorePassword[i].setSensitive(true);
        keyStorePassword[i].setArgumentGroupName(groupName);
        parser.addArgument(keyStorePassword[i]);
        keyStorePasswordFile[i] = new FileArgument(null, genArgName(i, "keyStorePasswordFile"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PASSWORD_FILE.get(), true, true, true, false);
        if (includeAlternateLongIdentifiers()) {
            keyStorePasswordFile[i].addLongIdentifier(genDashedArgName(i, "key-store-password-file"), true);
        }
        keyStorePasswordFile[i].setArgumentGroupName(groupName);
        parser.addArgument(keyStorePasswordFile[i]);
        keyStoreFormat[i] = new StringArgument(null, genArgName(i, "keyStoreFormat"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_FORMAT.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_FORMAT.get());
        if (includeAlternateLongIdentifiers()) {
            keyStoreFormat[i].addLongIdentifier(genDashedArgName(i, "key-store-format"), true);
            keyStoreFormat[i].addLongIdentifier(genArgName(i, "keyStoreType"), true);
            keyStoreFormat[i].addLongIdentifier(genDashedArgName(i, "key-store-type"), true);
        }
        keyStoreFormat[i].setArgumentGroupName(groupName);
        parser.addArgument(keyStoreFormat[i]);
        trustStorePath[i] = new StringArgument(null, genArgName(i, "trustStorePath"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PATH.get());
        if (includeAlternateLongIdentifiers()) {
            trustStorePath[i].addLongIdentifier(genDashedArgName(i, "trust-store-path"), true);
        }
        trustStorePath[i].setArgumentGroupName(groupName);
        parser.addArgument(trustStorePath[i]);
        trustStorePassword[i] = new StringArgument(null, genArgName(i, "trustStorePassword"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PASSWORD.get());
        if (includeAlternateLongIdentifiers()) {
            trustStorePassword[i].addLongIdentifier(genDashedArgName(i, "trust-store-password"), true);
        }
        trustStorePassword[i].setSensitive(true);
        trustStorePassword[i].setArgumentGroupName(groupName);
        parser.addArgument(trustStorePassword[i]);
        trustStorePasswordFile[i] = new FileArgument(null, genArgName(i, "trustStorePasswordFile"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PASSWORD_FILE.get(), true, true, true, false);
        if (includeAlternateLongIdentifiers()) {
            trustStorePasswordFile[i].addLongIdentifier(genDashedArgName(i, "trust-store-password-file"), true);
        }
        trustStorePasswordFile[i].setArgumentGroupName(groupName);
        parser.addArgument(trustStorePasswordFile[i]);
        trustStoreFormat[i] = new StringArgument(null, genArgName(i, "trustStoreFormat"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_FORMAT.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_FORMAT.get());
        if (includeAlternateLongIdentifiers()) {
            trustStoreFormat[i].addLongIdentifier(genDashedArgName(i, "trust-store-format"), true);
            trustStoreFormat[i].addLongIdentifier(genArgName(i, "trustStoreType"), true);
            trustStoreFormat[i].addLongIdentifier(genDashedArgName(i, "trust-store-type"), true);
        }
        trustStoreFormat[i].setArgumentGroupName(groupName);
        parser.addArgument(trustStoreFormat[i]);
        certificateNickname[i] = new StringArgument(null, genArgName(i, "certNickname"), false, 1, INFO_LDAP_TOOL_PLACEHOLDER_CERT_NICKNAME.get(), INFO_LDAP_TOOL_DESCRIPTION_CERT_NICKNAME.get());
        if (includeAlternateLongIdentifiers()) {
            certificateNickname[i].addLongIdentifier(genDashedArgName(i, "cert-nickname"), true);
            certificateNickname[i].addLongIdentifier(genArgName(i, "certificateNickname"), true);
            certificateNickname[i].addLongIdentifier(genDashedArgName(i, "certificate-nickname"), true);
        }
        certificateNickname[i].setArgumentGroupName(groupName);
        parser.addArgument(certificateNickname[i]);
        saslOption[i] = new StringArgument(null, genArgName(i, "saslOption"), false, 0, INFO_LDAP_TOOL_PLACEHOLDER_SASL_OPTION.get(), INFO_LDAP_TOOL_DESCRIPTION_SASL_OPTION.get());
        if (includeAlternateLongIdentifiers()) {
            saslOption[i].addLongIdentifier(genDashedArgName(i, "sasl-option"), true);
        }
        saslOption[i].setArgumentGroupName(groupName);
        parser.addArgument(saslOption[i]);
        parser.addDependentArgumentSet(bindDN[i], bindPassword[i], bindPasswordFile[i]);
        parser.addExclusiveArgumentSet(useSSL[i], useStartTLS[i]);
        parser.addExclusiveArgumentSet(bindPassword[i], bindPasswordFile[i]);
        parser.addExclusiveArgumentSet(keyStorePassword[i], keyStorePasswordFile[i]);
        parser.addExclusiveArgumentSet(trustStorePassword[i], trustStorePasswordFile[i]);
        parser.addExclusiveArgumentSet(trustAll[i], trustStorePath[i]);
        parser.addExclusiveArgumentSet(trustAll[i], defaultTrust[i]);
    }
    addNonLDAPArguments(parser);
}
Also used : DNArgument(com.unboundid.util.args.DNArgument) 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 23 with IntegerArgument

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

the class TestLDAPCommandLineTool method addNonLDAPArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addNonLDAPArguments(final ArgumentParser parser) throws ArgumentException {
    final ArgumentParser argListParser1 = new ArgumentParser("argumentList1", "Argument List 1 Description");
    argListParser1.addArgument(new StringArgument(null, "foo", false, -1, "{foo}", "Foo Description"));
    final ArgumentParser argListParser2 = new ArgumentParser("argumentList2", "Argument List 2 Description");
    argListParser2.addArgument(new StringArgument(null, "bar", false, -1, "{bar}", "Bar Description"));
    singleValuedArgumentListArgument = new ArgumentListArgument(null, "singleValuedArgumentList", false, 1, "{argList}", "Argument List", argListParser1);
    parser.addArgument(singleValuedArgumentListArgument);
    multiValuedArgumentListArgument = new ArgumentListArgument(null, "multiValuedArgumentList", false, -1, "{argList}", "Argument List", argListParser2);
    parser.addArgument(multiValuedArgumentListArgument);
    booleanArgument = new BooleanArgument(null, "boolean", "Boolean Description");
    parser.addArgument(booleanArgument);
    booleanValueArgument = new BooleanValueArgument(null, "booleanValue", false, "{true|false}", "Boolean Value Description");
    parser.addArgument(booleanValueArgument);
    singleValuedControlArgument = new ControlArgument(null, "singleValuedControl", false, 1, null, "Control Description");
    parser.addArgument(singleValuedControlArgument);
    multiValuedControlArgument = new ControlArgument(null, "multiValuedControl", false, -1, null, "Control Description");
    parser.addArgument(multiValuedControlArgument);
    singleValuedDNArgument = new DNArgument(null, "singleValuedDN", false, 1, "{dn}", "DN Description");
    parser.addArgument(singleValuedDNArgument);
    multiValuedDNArgument = new DNArgument(null, "multiValuedDN", false, -1, "{dn}", "DN Description");
    parser.addArgument(multiValuedDNArgument);
    durationArgument = new DurationArgument(null, "duration", false, "{duration}", "Duration Description");
    parser.addArgument(durationArgument);
    singleValuedFileArgument = new FileArgument(null, "singleValuedFile", false, 1, "{path}", "File Description", false, true, true, false);
    parser.addArgument(singleValuedFileArgument);
    multiValuedFileArgument = new FileArgument(null, "multiValuedFile", false, -1, "{path}", "File Description", false, false, false, false);
    parser.addArgument(multiValuedFileArgument);
    singleValuedFilterArgument = new FilterArgument(null, "singleValuedFilter", false, 1, "{filter}", "Filter Description");
    parser.addArgument(singleValuedFilterArgument);
    multiValuedFilterArgument = new FilterArgument(null, "multiValuedFilter", false, -1, "{filter}", "Filter Description");
    parser.addArgument(multiValuedFilterArgument);
    singleValuedTimestampArgument = new TimestampArgument(null, "singleValuedGeneralizedTime", false, 1, "{timestamp}", "Generalized Time Description");
    parser.addArgument(singleValuedTimestampArgument);
    multiValuedTimestampArgument = new TimestampArgument(null, "multiValuedGeneralizedTime", false, -1, "{timestamp}", "Generalized Time Description");
    parser.addArgument(multiValuedTimestampArgument);
    singleValuedIntegerArgument = new IntegerArgument(null, "singleValuedInteger", false, 1, "{int}", "Integer Description");
    parser.addArgument(singleValuedIntegerArgument);
    multiValuedIntegerArgument = new IntegerArgument(null, "multiValuedInteger", false, -1, "{int}", "Integer Description");
    parser.addArgument(multiValuedIntegerArgument);
    scopeArgument = new ScopeArgument(null, "scope", false, "{scope}", "Scope Description");
    parser.addArgument(scopeArgument);
    singleValuedStringArgument = new StringArgument(null, "singleValuedString", false, 1, "{string}", "String Description");
    parser.addArgument(singleValuedStringArgument);
    multiValuedOpenOptionsStringArgument = new StringArgument(null, "multiValuedOpenOptionsString", false, -1, "{string}", "String Description");
    parser.addArgument(multiValuedOpenOptionsStringArgument);
    final LinkedHashSet<String> allowedValues = new LinkedHashSet<String>(5);
    allowedValues.add("first");
    allowedValues.add("second");
    allowedValues.add("third");
    allowedValues.add("fourth");
    allowedValues.add("fifth");
    multiValuedFixedOptionsStringArgument = new StringArgument(null, "multiValuedFixedOptionsString", false, -1, "{string}", "String Description", allowedValues);
    parser.addArgument(multiValuedFixedOptionsStringArgument);
    resultCodeArgument = new IntegerArgument(null, "resultCode", true, 1, "{intValue}", "The result code");
    parser.addArgument(resultCodeArgument);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ScopeArgument(com.unboundid.util.args.ScopeArgument) DurationArgument(com.unboundid.util.args.DurationArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) FileArgument(com.unboundid.util.args.FileArgument) ArgumentParser(com.unboundid.util.args.ArgumentParser) StringArgument(com.unboundid.util.args.StringArgument) ControlArgument(com.unboundid.util.args.ControlArgument) DNArgument(com.unboundid.util.args.DNArgument) FilterArgument(com.unboundid.util.args.FilterArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) BooleanValueArgument(com.unboundid.util.args.BooleanValueArgument) TimestampArgument(com.unboundid.util.args.TimestampArgument) ArgumentListArgument(com.unboundid.util.args.ArgumentListArgument)

Example 24 with IntegerArgument

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

the class LDAPCommandLineTool method addToolArguments.

/**
 * {@inheritDoc}
 */
@Override()
public final void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    final String argumentGroup;
    final boolean supportsAuthentication = supportsAuthentication();
    if (supportsAuthentication) {
        argumentGroup = INFO_LDAP_TOOL_ARG_GROUP_CONNECT_AND_AUTH.get();
    } else {
        argumentGroup = INFO_LDAP_TOOL_ARG_GROUP_CONNECT.get();
    }
    host = new StringArgument(getShortIdentifierIfNotSuppressed('h'), "hostname", true, (supportsMultipleServers() ? 0 : 1), INFO_LDAP_TOOL_PLACEHOLDER_HOST.get(), INFO_LDAP_TOOL_DESCRIPTION_HOST.get(), "localhost");
    if (includeAlternateLongIdentifiers()) {
        host.addLongIdentifier("host", true);
        host.addLongIdentifier("address", true);
    }
    host.setArgumentGroupName(argumentGroup);
    parser.addArgument(host);
    port = new IntegerArgument(getShortIdentifierIfNotSuppressed('p'), "port", true, (supportsMultipleServers() ? 0 : 1), INFO_LDAP_TOOL_PLACEHOLDER_PORT.get(), INFO_LDAP_TOOL_DESCRIPTION_PORT.get(), 1, 65_535, 389);
    port.setArgumentGroupName(argumentGroup);
    parser.addArgument(port);
    if (supportsAuthentication) {
        bindDN = new DNArgument(getShortIdentifierIfNotSuppressed('D'), "bindDN", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_DN.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_DN.get());
        bindDN.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            bindDN.addLongIdentifier("bind-dn", true);
        }
        parser.addArgument(bindDN);
        bindPassword = new StringArgument(getShortIdentifierIfNotSuppressed('w'), "bindPassword", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_PW.get());
        bindPassword.setSensitive(true);
        bindPassword.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            bindPassword.addLongIdentifier("bind-password", true);
        }
        parser.addArgument(bindPassword);
        bindPasswordFile = new FileArgument(getShortIdentifierIfNotSuppressed('j'), "bindPasswordFile", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_BIND_PW_FILE.get(), true, true, true, false);
        bindPasswordFile.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            bindPasswordFile.addLongIdentifier("bind-password-file", true);
        }
        parser.addArgument(bindPasswordFile);
        promptForBindPassword = new BooleanArgument(null, "promptForBindPassword", 1, INFO_LDAP_TOOL_DESCRIPTION_BIND_PW_PROMPT.get());
        promptForBindPassword.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            promptForBindPassword.addLongIdentifier("prompt-for-bind-password", true);
        }
        parser.addArgument(promptForBindPassword);
    }
    useSSL = new BooleanArgument(getShortIdentifierIfNotSuppressed('Z'), "useSSL", 1, INFO_LDAP_TOOL_DESCRIPTION_USE_SSL.get());
    useSSL.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        useSSL.addLongIdentifier("use-ssl", true);
    }
    parser.addArgument(useSSL);
    useStartTLS = new BooleanArgument(getShortIdentifierIfNotSuppressed('q'), "useStartTLS", 1, INFO_LDAP_TOOL_DESCRIPTION_USE_START_TLS.get());
    useStartTLS.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        useStartTLS.addLongIdentifier("use-starttls", true);
        useStartTLS.addLongIdentifier("use-start-tls", true);
    }
    parser.addArgument(useStartTLS);
    final String defaultTrustArgDesc;
    if (InternalSDKHelper.getPingIdentityServerRoot() != null) {
        defaultTrustArgDesc = INFO_LDAP_TOOL_DESCRIPTION_DEFAULT_TRUST_WITH_PING_DS.get();
    } else {
        defaultTrustArgDesc = INFO_LDAP_TOOL_DESCRIPTION_DEFAULT_TRUST_WITHOUT_PING_DS.get();
    }
    defaultTrust = new BooleanArgument(null, "defaultTrust", 1, defaultTrustArgDesc);
    defaultTrust.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        defaultTrust.addLongIdentifier("default-trust", true);
        defaultTrust.addLongIdentifier("useDefaultTrust", true);
        defaultTrust.addLongIdentifier("use-default-trust", true);
    }
    parser.addArgument(defaultTrust);
    trustAll = new BooleanArgument(getShortIdentifierIfNotSuppressed('X'), "trustAll", 1, INFO_LDAP_TOOL_DESCRIPTION_TRUST_ALL.get());
    trustAll.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        trustAll.addLongIdentifier("trustAllCertificates", true);
        trustAll.addLongIdentifier("trust-all", true);
        trustAll.addLongIdentifier("trust-all-certificates", true);
    }
    parser.addArgument(trustAll);
    keyStorePath = new StringArgument(getShortIdentifierIfNotSuppressed('K'), "keyStorePath", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PATH.get());
    keyStorePath.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        keyStorePath.addLongIdentifier("key-store-path", true);
    }
    parser.addArgument(keyStorePath);
    keyStorePassword = new StringArgument(getShortIdentifierIfNotSuppressed('W'), "keyStorePassword", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PASSWORD.get());
    keyStorePassword.setSensitive(true);
    keyStorePassword.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        keyStorePassword.addLongIdentifier("keyStorePIN", true);
        keyStorePassword.addLongIdentifier("key-store-password", true);
        keyStorePassword.addLongIdentifier("key-store-pin", true);
    }
    parser.addArgument(keyStorePassword);
    keyStorePasswordFile = new FileArgument(getShortIdentifierIfNotSuppressed('u'), "keyStorePasswordFile", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PASSWORD_FILE.get());
    keyStorePasswordFile.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        keyStorePasswordFile.addLongIdentifier("keyStorePINFile", true);
        keyStorePasswordFile.addLongIdentifier("key-store-password-file", true);
        keyStorePasswordFile.addLongIdentifier("key-store-pin-file", true);
    }
    parser.addArgument(keyStorePasswordFile);
    promptForKeyStorePassword = new BooleanArgument(null, "promptForKeyStorePassword", 1, INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_PASSWORD_PROMPT.get());
    promptForKeyStorePassword.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        promptForKeyStorePassword.addLongIdentifier("promptForKeyStorePIN", true);
        promptForKeyStorePassword.addLongIdentifier("prompt-for-key-store-password", true);
        promptForKeyStorePassword.addLongIdentifier("prompt-for-key-store-pin", true);
    }
    parser.addArgument(promptForKeyStorePassword);
    keyStoreFormat = new StringArgument(null, "keyStoreFormat", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_FORMAT.get(), INFO_LDAP_TOOL_DESCRIPTION_KEY_STORE_FORMAT.get());
    keyStoreFormat.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        keyStoreFormat.addLongIdentifier("keyStoreType", true);
        keyStoreFormat.addLongIdentifier("key-store-format", true);
        keyStoreFormat.addLongIdentifier("key-store-type", true);
    }
    parser.addArgument(keyStoreFormat);
    trustStorePath = new StringArgument(getShortIdentifierIfNotSuppressed('P'), "trustStorePath", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PATH.get());
    trustStorePath.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        trustStorePath.addLongIdentifier("trust-store-path", true);
    }
    parser.addArgument(trustStorePath);
    trustStorePassword = new StringArgument(getShortIdentifierIfNotSuppressed('T'), "trustStorePassword", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PASSWORD.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PASSWORD.get());
    trustStorePassword.setSensitive(true);
    trustStorePassword.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        trustStorePassword.addLongIdentifier("trustStorePIN", true);
        trustStorePassword.addLongIdentifier("trust-store-password", true);
        trustStorePassword.addLongIdentifier("trust-store-pin", true);
    }
    parser.addArgument(trustStorePassword);
    trustStorePasswordFile = new FileArgument(getShortIdentifierIfNotSuppressed('U'), "trustStorePasswordFile", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_PATH.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PASSWORD_FILE.get());
    trustStorePasswordFile.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        trustStorePasswordFile.addLongIdentifier("trustStorePINFile", true);
        trustStorePasswordFile.addLongIdentifier("trust-store-password-file", true);
        trustStorePasswordFile.addLongIdentifier("trust-store-pin-file", true);
    }
    parser.addArgument(trustStorePasswordFile);
    promptForTrustStorePassword = new BooleanArgument(null, "promptForTrustStorePassword", 1, INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_PASSWORD_PROMPT.get());
    promptForTrustStorePassword.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        promptForTrustStorePassword.addLongIdentifier("promptForTrustStorePIN", true);
        promptForTrustStorePassword.addLongIdentifier("prompt-for-trust-store-password", true);
        promptForTrustStorePassword.addLongIdentifier("prompt-for-trust-store-pin", true);
    }
    parser.addArgument(promptForTrustStorePassword);
    trustStoreFormat = new StringArgument(null, "trustStoreFormat", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_FORMAT.get(), INFO_LDAP_TOOL_DESCRIPTION_TRUST_STORE_FORMAT.get());
    trustStoreFormat.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        trustStoreFormat.addLongIdentifier("trustStoreType", true);
        trustStoreFormat.addLongIdentifier("trust-store-format", true);
        trustStoreFormat.addLongIdentifier("trust-store-type", true);
    }
    parser.addArgument(trustStoreFormat);
    certificateNickname = new StringArgument(getShortIdentifierIfNotSuppressed('N'), "certNickname", false, 1, INFO_LDAP_TOOL_PLACEHOLDER_CERT_NICKNAME.get(), INFO_LDAP_TOOL_DESCRIPTION_CERT_NICKNAME.get());
    certificateNickname.setArgumentGroupName(argumentGroup);
    if (includeAlternateLongIdentifiers()) {
        certificateNickname.addLongIdentifier("certificateNickname", true);
        certificateNickname.addLongIdentifier("cert-nickname", true);
        certificateNickname.addLongIdentifier("certificate-nickname", true);
    }
    parser.addArgument(certificateNickname);
    if (supportsSSLDebugging()) {
        enableSSLDebugging = new BooleanArgument(null, "enableSSLDebugging", 1, INFO_LDAP_TOOL_DESCRIPTION_ENABLE_SSL_DEBUGGING.get());
        enableSSLDebugging.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            enableSSLDebugging.addLongIdentifier("enableTLSDebugging", true);
            enableSSLDebugging.addLongIdentifier("enableStartTLSDebugging", true);
            enableSSLDebugging.addLongIdentifier("enable-ssl-debugging", true);
            enableSSLDebugging.addLongIdentifier("enable-tls-debugging", true);
            enableSSLDebugging.addLongIdentifier("enable-starttls-debugging", true);
            enableSSLDebugging.addLongIdentifier("enable-start-tls-debugging", true);
        }
        parser.addArgument(enableSSLDebugging);
        addEnableSSLDebuggingArgument(enableSSLDebugging);
    }
    if (supportsAuthentication) {
        saslOption = new StringArgument(getShortIdentifierIfNotSuppressed('o'), "saslOption", false, 0, INFO_LDAP_TOOL_PLACEHOLDER_SASL_OPTION.get(), INFO_LDAP_TOOL_DESCRIPTION_SASL_OPTION.get());
        saslOption.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            saslOption.addLongIdentifier("sasl-option", true);
        }
        parser.addArgument(saslOption);
        useSASLExternal = new BooleanArgument(null, "useSASLExternal", 1, INFO_LDAP_TOOL_DESCRIPTION_USE_SASL_EXTERNAL.get());
        useSASLExternal.setArgumentGroupName(argumentGroup);
        if (includeAlternateLongIdentifiers()) {
            useSASLExternal.addLongIdentifier("use-sasl-external", true);
        }
        parser.addArgument(useSASLExternal);
        if (supportsSASLHelp()) {
            helpSASL = new BooleanArgument(null, "helpSASL", INFO_LDAP_TOOL_DESCRIPTION_HELP_SASL.get());
            helpSASL.setArgumentGroupName(argumentGroup);
            if (includeAlternateLongIdentifiers()) {
                helpSASL.addLongIdentifier("help-sasl", true);
            }
            helpSASL.setUsageArgument(true);
            parser.addArgument(helpSASL);
            setHelpSASLArgument(helpSASL);
        }
    }
    // Both useSSL and useStartTLS cannot be used together.
    parser.addExclusiveArgumentSet(useSSL, useStartTLS);
    // Only one option may be used for specifying the key store password.
    parser.addExclusiveArgumentSet(keyStorePassword, keyStorePasswordFile, promptForKeyStorePassword);
    // Only one option may be used for specifying the trust store password.
    parser.addExclusiveArgumentSet(trustStorePassword, trustStorePasswordFile, promptForTrustStorePassword);
    // The defaultTrust argument cannot be used in conjunction with the
    // trustAll argument.
    parser.addExclusiveArgumentSet(defaultTrust, trustAll);
    // It doesn't make sense to provide a trust store path if any server
    // certificate should be trusted.
    parser.addExclusiveArgumentSet(trustAll, trustStorePath);
    // If a key store password is provided, then a key store path must have also
    // been provided.
    parser.addDependentArgumentSet(keyStorePassword, keyStorePath);
    parser.addDependentArgumentSet(keyStorePasswordFile, keyStorePath);
    parser.addDependentArgumentSet(promptForKeyStorePassword, keyStorePath);
    // If a trust store password is provided, then a trust store path must have
    // also been provided.
    parser.addDependentArgumentSet(trustStorePassword, trustStorePath);
    parser.addDependentArgumentSet(trustStorePasswordFile, trustStorePath);
    parser.addDependentArgumentSet(promptForTrustStorePassword, trustStorePath);
    // If a key or trust store path is provided, then the tool must either use
    // SSL or StartTLS.
    parser.addDependentArgumentSet(keyStorePath, useSSL, useStartTLS);
    parser.addDependentArgumentSet(trustStorePath, useSSL, useStartTLS);
    // If the default trust argument was used, then the tool must either use
    // SSL or StartTLS.
    parser.addDependentArgumentSet(defaultTrust, useSSL, useStartTLS);
    // If the tool should trust all server certificates, then the tool must
    // either use SSL or StartTLS.
    parser.addDependentArgumentSet(trustAll, useSSL, useStartTLS);
    if (supportsAuthentication) {
        // provided unless defaultToPromptForBindPassword returns true.
        if (!defaultToPromptForBindPassword()) {
            parser.addDependentArgumentSet(bindDN, bindPassword, bindPasswordFile, promptForBindPassword);
        }
        // The bindDN, saslOption, and useSASLExternal arguments are all mutually
        // exclusive.
        parser.addExclusiveArgumentSet(bindDN, saslOption, useSASLExternal);
        // Only one option may be used for specifying the bind password.
        parser.addExclusiveArgumentSet(bindPassword, bindPasswordFile, promptForBindPassword);
        // If a bind password was provided, then the a bind DN or SASL option
        // must have also been provided.
        parser.addDependentArgumentSet(bindPassword, bindDN, saslOption);
        parser.addDependentArgumentSet(bindPasswordFile, bindDN, saslOption);
        parser.addDependentArgumentSet(promptForBindPassword, bindDN, saslOption);
    }
    addNonLDAPArguments(parser);
}
Also used : DNArgument(com.unboundid.util.args.DNArgument) 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 25 with IntegerArgument

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

the class InMemoryDirectoryServerTool method addToolArguments.

/**
 * {@inheritDoc}
 */
@Override()
public void addToolArguments(@NotNull final ArgumentParser parser) throws ArgumentException {
    portArgument = new IntegerArgument('p', "port", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PORT.get(), INFO_MEM_DS_TOOL_ARG_DESC_PORT.get(), 0, 65_535);
    portArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    parser.addArgument(portArgument);
    useSSLArgument = new BooleanArgument('Z', "useSSL", INFO_MEM_DS_TOOL_ARG_DESC_USE_SSL.get());
    useSSLArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    useSSLArgument.addLongIdentifier("use-ssl", true);
    parser.addArgument(useSSLArgument);
    useStartTLSArgument = new BooleanArgument('q', "useStartTLS", INFO_MEM_DS_TOOL_ARG_DESC_USE_START_TLS.get());
    useStartTLSArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    useStartTLSArgument.addLongIdentifier("use-starttls", true);
    useStartTLSArgument.addLongIdentifier("use-start-tls", true);
    parser.addArgument(useStartTLSArgument);
    keyStorePathArgument = new FileArgument('K', "keyStorePath", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_KEY_STORE_PATH.get(), true, true, true, false);
    keyStorePathArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    keyStorePathArgument.addLongIdentifier("key-store-path", true);
    parser.addArgument(keyStorePathArgument);
    keyStorePasswordArgument = new StringArgument('W', "keyStorePassword", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PASSWORD.get(), INFO_MEM_DS_TOOL_ARG_DESC_KEY_STORE_PW.get());
    keyStorePasswordArgument.setSensitive(true);
    keyStorePasswordArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    keyStorePasswordArgument.addLongIdentifier("keyStorePIN", true);
    keyStorePasswordArgument.addLongIdentifier("key-store-password", true);
    keyStorePasswordArgument.addLongIdentifier("key-store-pin", true);
    parser.addArgument(keyStorePasswordArgument);
    keyStoreTypeArgument = new StringArgument(null, "keyStoreType", false, 1, "{type}", INFO_MEM_DS_TOOL_ARG_DESC_KEY_STORE_TYPE.get(), CryptoHelper.KEY_STORE_TYPE_JKS);
    keyStoreTypeArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    keyStoreTypeArgument.addLongIdentifier("keyStoreFormat", true);
    keyStoreTypeArgument.addLongIdentifier("key-store-type", true);
    keyStoreTypeArgument.addLongIdentifier("key-store-format", true);
    parser.addArgument(keyStoreTypeArgument);
    generateSelfSignedCertificateArgument = new BooleanArgument(null, "generateSelfSignedCertificate", 1, INFO_MEM_DS_TOOL_ARG_DESC_SELF_SIGNED_CERT.get());
    generateSelfSignedCertificateArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    generateSelfSignedCertificateArgument.addLongIdentifier("useSelfSignedCertificate", true);
    generateSelfSignedCertificateArgument.addLongIdentifier("selfSignedCertificate", true);
    generateSelfSignedCertificateArgument.addLongIdentifier("generate-self-signed-certificate", true);
    generateSelfSignedCertificateArgument.addLongIdentifier("use-self-signed-certificate", true);
    generateSelfSignedCertificateArgument.addLongIdentifier("self-signed-certificate", true);
    parser.addArgument(generateSelfSignedCertificateArgument);
    trustStorePathArgument = new FileArgument('P', "trustStorePath", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_TRUST_STORE_PATH.get(), true, true, true, false);
    trustStorePathArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    trustStorePathArgument.addLongIdentifier("trust-store-path", true);
    parser.addArgument(trustStorePathArgument);
    trustStorePasswordArgument = new StringArgument('T', "trustStorePassword", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PASSWORD.get(), INFO_MEM_DS_TOOL_ARG_DESC_TRUST_STORE_PW.get());
    trustStorePasswordArgument.setSensitive(true);
    trustStorePasswordArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    trustStorePasswordArgument.addLongIdentifier("trustStorePIN", true);
    trustStorePasswordArgument.addLongIdentifier("trust-store-password", true);
    trustStorePasswordArgument.addLongIdentifier("trust-store-pin", true);
    parser.addArgument(trustStorePasswordArgument);
    trustStoreTypeArgument = new StringArgument(null, "trustStoreType", false, 1, "{type}", INFO_MEM_DS_TOOL_ARG_DESC_TRUST_STORE_TYPE.get(), CryptoHelper.KEY_STORE_TYPE_JKS);
    trustStoreTypeArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    trustStoreTypeArgument.addLongIdentifier("trustStoreFormat", true);
    trustStoreTypeArgument.addLongIdentifier("trust-store-type", true);
    trustStoreTypeArgument.addLongIdentifier("trust-store-format", true);
    parser.addArgument(trustStoreTypeArgument);
    sslClientAuthPolicy = new StringArgument(null, "sslClientAuthPolicy", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_SSL_CLIENT_AUTH_POLICY.get(), INFO_MEM_DS_TOOL_ARG_DESC_SSL_CLIENT_AUTH_POLICY.get(), StaticUtils.setOf(SSL_CLIENT_AUTH_POLICY_PROHIBITED, SSL_CLIENT_AUTH_POLICY_OPTIONAL, SSL_CLIENT_AUTH_POLICY_REQUIRED), SSL_CLIENT_AUTH_POLICY_PROHIBITED);
    sslClientAuthPolicy.addLongIdentifier("ssl-client-auth-policy", true);
    sslClientAuthPolicy.addLongIdentifier("sslClientAuthenticationPolicy", true);
    sslClientAuthPolicy.addLongIdentifier("ssl-client-authentication-policy", true);
    sslClientAuthPolicy.addLongIdentifier("sslClientCertificatePolicy", true);
    sslClientAuthPolicy.addLongIdentifier("ssl-client-certificate-policy", true);
    sslClientAuthPolicy.addLongIdentifier("sslClientCertPolicy", true);
    sslClientAuthPolicy.addLongIdentifier("ssl-client-cert-policy", true);
    sslClientAuthPolicy.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    parser.addArgument(sslClientAuthPolicy);
    maxConcurrentConnectionsArgument = new IntegerArgument(null, "maxConcurrentConnections", false, 1, null, INFO_MEM_DS_TOOL_ARG_DESC_MAX_CONNECTIONS.get(), 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
    maxConcurrentConnectionsArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    maxConcurrentConnectionsArgument.addLongIdentifier("maximumConcurrentConnections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("maxConnections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("maximumConnections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("max-concurrent-connections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("maximum-concurrent-connections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("max-connections", true);
    maxConcurrentConnectionsArgument.addLongIdentifier("maximum-connections", true);
    parser.addArgument(maxConcurrentConnectionsArgument);
    dontStartArgument = new BooleanArgument(null, "dontStart", INFO_MEM_DS_TOOL_ARG_DESC_DONT_START.get());
    dontStartArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_CONNECTIVITY.get());
    dontStartArgument.setHidden(true);
    dontStartArgument.addLongIdentifier("doNotStart", true);
    dontStartArgument.addLongIdentifier("dont-start", true);
    dontStartArgument.addLongIdentifier("do-not-start", true);
    parser.addArgument(dontStartArgument);
    baseDNArgument = new DNArgument('b', "baseDN", true, 0, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_BASE_DN.get(), INFO_MEM_DS_TOOL_ARG_DESC_BASE_DN.get());
    baseDNArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    baseDNArgument.addLongIdentifier("base-dn", true);
    parser.addArgument(baseDNArgument);
    ldifFileArgument = new FileArgument('l', "ldifFile", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_LDIF_FILE.get(), true, true, true, false);
    ldifFileArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    ldifFileArgument.addLongIdentifier("ldif-file", true);
    parser.addArgument(ldifFileArgument);
    additionalBindDNArgument = new DNArgument('D', "additionalBindDN", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_BIND_DN.get(), INFO_MEM_DS_TOOL_ARG_DESC_ADDITIONAL_BIND_DN.get());
    additionalBindDNArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    additionalBindDNArgument.addLongIdentifier("additional-bind-dn", true);
    parser.addArgument(additionalBindDNArgument);
    additionalBindPasswordArgument = new StringArgument('w', "additionalBindPassword", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PASSWORD.get(), INFO_MEM_DS_TOOL_ARG_DESC_ADDITIONAL_BIND_PW.get());
    additionalBindPasswordArgument.setSensitive(true);
    additionalBindPasswordArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    additionalBindPasswordArgument.addLongIdentifier("additional-bind-password", true);
    parser.addArgument(additionalBindPasswordArgument);
    useDefaultSchemaArgument = new BooleanArgument('s', "useDefaultSchema", INFO_MEM_DS_TOOL_ARG_DESC_USE_DEFAULT_SCHEMA.get());
    useDefaultSchemaArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    useDefaultSchemaArgument.addLongIdentifier("use-default-schema", true);
    parser.addArgument(useDefaultSchemaArgument);
    useSchemaFileArgument = new FileArgument('S', "useSchemaFile", false, 0, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_USE_SCHEMA_FILE.get(), true, true, false, false);
    useSchemaFileArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    useSchemaFileArgument.addLongIdentifier("use-schema-file", true);
    parser.addArgument(useSchemaFileArgument);
    doNotValidateSchemaDefinitionsArgument = new BooleanArgument(null, "doNotValidateSchemaDefinitions", 1, INFO_MEM_DS_TOOL_ARG_DESC_DO_NOT_VALIDATE_SCHEMA.get(useSchemaFileArgument.getIdentifierString()));
    doNotValidateSchemaDefinitionsArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    doNotValidateSchemaDefinitionsArgument.addLongIdentifier("do-not-validate-schema-definitions", true);
    parser.addArgument(doNotValidateSchemaDefinitionsArgument);
    doNotGenerateOperationalAttributesArgument = new BooleanArgument(null, "doNotGenerateOperationalAttributes", 1, INFO_MEM_DS_TOOL_ARG_DESC_DO_NOT_GENERATE_OP_ATTRS.get());
    doNotGenerateOperationalAttributesArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    doNotGenerateOperationalAttributesArgument.addLongIdentifier("do-not-generate-operational-attributes");
    parser.addArgument(doNotGenerateOperationalAttributesArgument);
    equalityIndexArgument = new StringArgument('I', "equalityIndex", false, 0, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_ATTR.get(), INFO_MEM_DS_TOOL_ARG_DESC_EQ_INDEX.get());
    equalityIndexArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    equalityIndexArgument.addLongIdentifier("equality-index", true);
    parser.addArgument(equalityIndexArgument);
    maxChangeLogEntriesArgument = new IntegerArgument('c', "maxChangeLogEntries", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_COUNT.get(), INFO_MEM_DS_TOOL_ARG_DESC_MAX_CHANGELOG_ENTRIES.get(), 0, Integer.MAX_VALUE, 0);
    maxChangeLogEntriesArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    maxChangeLogEntriesArgument.addLongIdentifier("max-changelog-entries", true);
    maxChangeLogEntriesArgument.addLongIdentifier("max-change-log-entries", true);
    parser.addArgument(maxChangeLogEntriesArgument);
    sizeLimitArgument = new IntegerArgument(null, "sizeLimit", false, 1, null, INFO_MEM_DS_TOOL_ARG_DESC_SIZE_LIMIT.get(), 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
    sizeLimitArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    sizeLimitArgument.addLongIdentifier("searchSizeLimit", true);
    sizeLimitArgument.addLongIdentifier("size-limit", true);
    sizeLimitArgument.addLongIdentifier("search-size-limit", true);
    parser.addArgument(sizeLimitArgument);
    passwordAttributeArgument = new StringArgument(null, "passwordAttribute", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_ATTR.get(), INFO_MEM_DS_TOOL_ARG_DESC_PASSWORD_ATTRIBUTE.get(), "userPassword");
    passwordAttributeArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    passwordAttributeArgument.addLongIdentifier("passwordAttributeType", true);
    passwordAttributeArgument.addLongIdentifier("password-attribute", true);
    passwordAttributeArgument.addLongIdentifier("password-attribute-type", true);
    parser.addArgument(passwordAttributeArgument);
    final Set<String> allowedSchemes = StaticUtils.setOf("md5", "smd5", "sha", "ssha", "sha256", "ssha256", "sha384", "ssha384", "sha512", "ssha512", "clear", "base64", "hex");
    defaultPasswordEncodingArgument = new StringArgument(null, "defaultPasswordEncoding", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_SCHEME.get(), INFO_MEM_DS_TOOL_ARG_DESC_DEFAULT_PASSWORD_ENCODING.get(), allowedSchemes);
    defaultPasswordEncodingArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    defaultPasswordEncodingArgument.addLongIdentifier("defaultPasswordEncodingScheme", true);
    defaultPasswordEncodingArgument.addLongIdentifier("defaultPasswordStorageScheme", true);
    defaultPasswordEncodingArgument.addLongIdentifier("defaultPasswordScheme", true);
    defaultPasswordEncodingArgument.addLongIdentifier("default-password-encoding", true);
    defaultPasswordEncodingArgument.addLongIdentifier("default-password-encoding-scheme", true);
    defaultPasswordEncodingArgument.addLongIdentifier("default-password-storage-scheme", true);
    defaultPasswordEncodingArgument.addLongIdentifier("default-password-scheme", true);
    parser.addArgument(defaultPasswordEncodingArgument);
    final Set<String> allowedOperationTypeAllowedValues = StaticUtils.setOf("add", "bind", "compare", "delete", "extended", "modify", "modify-dn", "search");
    allowedOperationTypeArgument = new StringArgument(null, "allowedOperationType", false, 0, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_TYPE.get(), INFO_MEM_DS_TOOL_ARG_DESC_ALLOWED_OP_TYPE.get(), allowedOperationTypeAllowedValues);
    allowedOperationTypeArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    allowedOperationTypeArgument.addLongIdentifier("allowed-operation-type", true);
    parser.addArgument(allowedOperationTypeArgument);
    final Set<String> authRequiredTypeAllowedValues = StaticUtils.setOf("add", "compare", "delete", "extended", "modify", "modify-dn", "search");
    authenticationRequiredOperationTypeArgument = new StringArgument(null, "authenticationRequiredOperationType", false, 0, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_TYPE.get(), INFO_MEM_DS_TOOL_ARG_DESC_AUTH_REQUIRED_OP_TYPE.get(), authRequiredTypeAllowedValues);
    authenticationRequiredOperationTypeArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    authenticationRequiredOperationTypeArgument.addLongIdentifier("requiredAuthenticationOperationType", true);
    authenticationRequiredOperationTypeArgument.addLongIdentifier("requireAuthenticationOperationType", true);
    authenticationRequiredOperationTypeArgument.addLongIdentifier("authentication-required-operation-type", true);
    authenticationRequiredOperationTypeArgument.addLongIdentifier("required-authentication-operation-type", true);
    authenticationRequiredOperationTypeArgument.addLongIdentifier("require-authentication-operation-type", true);
    parser.addArgument(authenticationRequiredOperationTypeArgument);
    vendorNameArgument = new StringArgument(null, "vendorName", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_VALUE.get(), INFO_MEM_DS_TOOL_ARG_DESC_VENDOR_NAME.get());
    vendorNameArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    vendorNameArgument.addLongIdentifier("vendor-name", true);
    parser.addArgument(vendorNameArgument);
    vendorVersionArgument = new StringArgument(null, "vendorVersion", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_VALUE.get(), INFO_MEM_DS_TOOL_ARG_DESC_VENDOR_VERSION.get());
    vendorVersionArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_DATA.get());
    vendorVersionArgument.addLongIdentifier("vendor-version", true);
    parser.addArgument(vendorVersionArgument);
    accessLogToStandardOutArgument = new BooleanArgument('A', "accessLogToStandardOut", INFO_MEM_DS_TOOL_ARG_DESC_ACCESS_LOG_TO_STDOUT.get());
    accessLogToStandardOutArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    accessLogToStandardOutArgument.addLongIdentifier("access-log-to-standard-out", true);
    parser.addArgument(accessLogToStandardOutArgument);
    accessLogFileArgument = new FileArgument('a', "accessLogFile", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_ACCESS_LOG_FILE.get(), false, true, true, false);
    accessLogFileArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    accessLogFileArgument.addLongIdentifier("access-log-format", true);
    parser.addArgument(accessLogFileArgument);
    jsonAccessLogToStandardOutArgument = new BooleanArgument(null, "jsonAccessLogToStandardOut", INFO_MEM_DS_TOOL_ARG_DESC_JSON_ACCESS_LOG_TO_STDOUT.get());
    jsonAccessLogToStandardOutArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    jsonAccessLogToStandardOutArgument.addLongIdentifier("json-access-log-to-standard-out", true);
    parser.addArgument(jsonAccessLogToStandardOutArgument);
    jsonAccessLogFileArgument = new FileArgument(null, "jsonAccessLogFile", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_JSON_ACCESS_LOG_FILE.get(), false, true, true, false);
    jsonAccessLogFileArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    jsonAccessLogFileArgument.addLongIdentifier("json-access-log-format", true);
    parser.addArgument(jsonAccessLogFileArgument);
    ldapDebugLogToStandardOutArgument = new BooleanArgument(null, "ldapDebugLogToStandardOut", INFO_MEM_DS_TOOL_ARG_DESC_LDAP_DEBUG_LOG_TO_STDOUT.get());
    ldapDebugLogToStandardOutArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    ldapDebugLogToStandardOutArgument.addLongIdentifier("ldap-debug-log-to-standard-out", true);
    parser.addArgument(ldapDebugLogToStandardOutArgument);
    ldapDebugLogFileArgument = new FileArgument('d', "ldapDebugLogFile", false, 1, INFO_MEM_DS_TOOL_ARG_PLACEHOLDER_PATH.get(), INFO_MEM_DS_TOOL_ARG_DESC_LDAP_DEBUG_LOG_FILE.get(), false, true, true, false);
    ldapDebugLogFileArgument.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    ldapDebugLogFileArgument.addLongIdentifier("ldap-debug-log-file", true);
    parser.addArgument(ldapDebugLogFileArgument);
    codeLogFile = new FileArgument('C', "codeLogFile", false, 1, "{path}", INFO_MEM_DS_TOOL_ARG_DESC_CODE_LOG_FILE.get(), false, true, true, false);
    codeLogFile.setArgumentGroupName(INFO_MEM_DS_TOOL_GROUP_LOGGING.get());
    codeLogFile.addLongIdentifier("code-log-file", true);
    parser.addArgument(codeLogFile);
    parser.addExclusiveArgumentSet(useDefaultSchemaArgument, useSchemaFileArgument);
    parser.addDependentArgumentSet(doNotValidateSchemaDefinitionsArgument, useSchemaFileArgument);
    parser.addExclusiveArgumentSet(useSSLArgument, useStartTLSArgument);
    parser.addExclusiveArgumentSet(keyStorePathArgument, generateSelfSignedCertificateArgument);
    parser.addExclusiveArgumentSet(accessLogToStandardOutArgument, accessLogFileArgument);
    parser.addExclusiveArgumentSet(jsonAccessLogToStandardOutArgument, jsonAccessLogFileArgument);
    parser.addExclusiveArgumentSet(ldapDebugLogToStandardOutArgument, ldapDebugLogFileArgument);
    parser.addDependentArgumentSet(additionalBindDNArgument, additionalBindPasswordArgument);
    parser.addDependentArgumentSet(additionalBindPasswordArgument, additionalBindDNArgument);
    parser.addDependentArgumentSet(useSSLArgument, keyStorePathArgument, generateSelfSignedCertificateArgument);
    parser.addDependentArgumentSet(keyStorePathArgument, keyStorePasswordArgument);
    parser.addDependentArgumentSet(keyStorePasswordArgument, keyStorePathArgument);
    parser.addDependentArgumentSet(keyStoreTypeArgument, keyStorePathArgument);
    parser.addDependentArgumentSet(useStartTLSArgument, keyStorePathArgument, generateSelfSignedCertificateArgument);
    parser.addDependentArgumentSet(keyStorePathArgument, useSSLArgument, useStartTLSArgument);
    parser.addDependentArgumentSet(generateSelfSignedCertificateArgument, useSSLArgument, useStartTLSArgument);
    parser.addDependentArgumentSet(trustStorePathArgument, useSSLArgument, useStartTLSArgument);
    parser.addDependentArgumentSet(trustStorePasswordArgument, trustStorePathArgument);
    parser.addDependentArgumentSet(trustStoreTypeArgument, trustStorePathArgument);
}
Also used : DNArgument(com.unboundid.util.args.DNArgument) IntegerArgument(com.unboundid.util.args.IntegerArgument) BooleanArgument(com.unboundid.util.args.BooleanArgument) FileArgument(com.unboundid.util.args.FileArgument) StringArgument(com.unboundid.util.args.StringArgument)

Aggregations

IntegerArgument (com.unboundid.util.args.IntegerArgument)38 BooleanArgument (com.unboundid.util.args.BooleanArgument)35 StringArgument (com.unboundid.util.args.StringArgument)34 FileArgument (com.unboundid.util.args.FileArgument)29 DNArgument (com.unboundid.util.args.DNArgument)23 FilterArgument (com.unboundid.util.args.FilterArgument)13 ControlArgument (com.unboundid.util.args.ControlArgument)11 ScopeArgument (com.unboundid.util.args.ScopeArgument)9 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)6 DurationArgument (com.unboundid.util.args.DurationArgument)6 LDAPException (com.unboundid.ldap.sdk.LDAPException)5 NotNull (com.unboundid.util.NotNull)5 ArgumentException (com.unboundid.util.args.ArgumentException)5 BooleanValueArgument (com.unboundid.util.args.BooleanValueArgument)5 TimestampArgument (com.unboundid.util.args.TimestampArgument)5 File (java.io.File)5 ASN1BitString (com.unboundid.asn1.ASN1BitString)4 DN (com.unboundid.ldap.sdk.DN)3 ArgumentParser (com.unboundid.util.args.ArgumentParser)3 SubCommand (com.unboundid.util.args.SubCommand)3