opendj-cli/src/main/java/com/forgerock/opendj/cli/AbstractAuthenticatedConnectionFactory.java
New file @@ -0,0 +1,53 @@ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt * or http://forgerock.org/license/CDDLv1.0.html. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at legal-notices/CDDLv1_0.txt. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; import org.forgerock.opendj.ldap.ConnectionFactory; import org.forgerock.opendj.ldap.requests.BindRequest; /** * Abstract authenticated connection factory implementation. */ abstract class AbstractAuthenticatedConnectionFactory { AbstractAuthenticatedConnectionFactory() { // No implementation required. } /** * Returns the new authenticated connection factory. * * @param connection * The connection factory. * @param request * The bind request. * @return A new authenticated connection factory. * @throws ArgumentException * If an error occurs when parsing the arguments. */ abstract ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException; } opendj-cli/src/main/java/com/forgerock/opendj/cli/ApplicationKeyManager.java
File was renamed from opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java @@ -23,9 +23,9 @@ * * Copyright 2008-2010 Sun Microsystems, Inc. * Portions Copyright 2009 Parametric Technology Corporation (PTC) * Portions copyright 2014 ForgeRock AS */ package com.forgerock.opendj.ldap.tools; package com.forgerock.opendj.cli; import java.net.Socket; import java.security.KeyStore; @@ -164,9 +164,8 @@ final Socket socket) { if (keyManager != null) { return keyManager.chooseClientAlias(keyType, issuers, socket); } else { return null; } return null; } /** @@ -187,13 +186,11 @@ * @return the alias name for the desired key, or null if there are no * matches. */ public String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket) { public String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket) { if (keyManager != null) { return keyManager.chooseServerAlias(keyType, issuers, socket); } else { return null; } return null; } /** @@ -208,9 +205,8 @@ public X509Certificate[] getCertificateChain(final String alias) { if (keyManager != null) { return keyManager.getCertificateChain(alias); } else { return null; } return null; } /** @@ -229,9 +225,8 @@ public String[] getClientAliases(final String keyType, final Principal[] issuers) { if (keyManager != null) { return keyManager.getClientAliases(keyType, issuers); } else { return null; } return null; } /** @@ -244,9 +239,8 @@ public PrivateKey getPrivateKey(final String alias) { if (keyManager != null) { return keyManager.getPrivateKey(alias); } else { return null; } return null; } /** @@ -265,8 +259,7 @@ public String[] getServerAliases(final String keyType, final Principal[] issuers) { if (keyManager != null) { return keyManager.getServerAliases(keyType, issuers); } else { return null; } return null; } } opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java
@@ -185,7 +185,8 @@ */ public static StringArgument getControl() throws ArgumentException { return new StringArgument(OPTION_LONG_CONTROL.toLowerCase(), OPTION_SHORT_CONTROL, OPTION_LONG_CONTROL, false, true, true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_CONTROLS.get()); true, true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, OPTION_LONG_CONTROL, INFO_DESCRIPTION_CONTROLS.get()); } /** @@ -656,8 +657,8 @@ * If there is a problem with any of the parameters used to create this argument. */ public static BooleanArgument getReportAuthzId() throws ArgumentException { final BooleanArgument report = new BooleanArgument("reportauthzid", 'E', "reportAuthzID", INFO_DESCRIPTION_REPORT_AUTHZID.get()); final BooleanArgument report = new BooleanArgument(OPTION_LONG_REPORT_AUTHZ_ID.toLowerCase(), 'E', OPTION_LONG_REPORT_AUTHZ_ID, INFO_DESCRIPTION_REPORT_AUTHZID.get()); report.setPropertyName("reportAuthzID"); return report; } opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java
File was renamed from opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java @@ -24,10 +24,11 @@ * Copyright 2010 Sun Microsystems, Inc. * Portions copyright 2011-2014 ForgeRock AS */ package com.forgerock.opendj.ldap.tools; package com.forgerock.opendj.cli; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; import static com.forgerock.opendj.cli.CliMessages.*; import static com.forgerock.opendj.cli.CliConstants.DEFAULT_LDAP_PORT; import java.io.File; import java.io.FileInputStream; @@ -47,15 +48,6 @@ import org.forgerock.i18n.LocalizableMessage; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.ClientException; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.FileBasedArgument; import com.forgerock.opendj.cli.IntegerArgument; import com.forgerock.opendj.cli.StringArgument; import org.forgerock.opendj.ldap.ConnectionFactory; import org.forgerock.opendj.ldap.KeyManagers; import org.forgerock.opendj.ldap.LDAPConnectionFactory; @@ -75,7 +67,7 @@ /** * A connection factory designed for use with command line tools. */ final class ConnectionFactoryProvider { public class ConnectionFactoryProvider extends AbstractAuthenticatedConnectionFactory { /** * The Logger. */ @@ -172,13 +164,14 @@ */ private final BooleanArgument usePasswordPolicyControlArg; private int port = 389; private int port = DEFAULT_LDAP_PORT; private SSLContext sslContext; private ConnectionFactory connFactory; private ConnectionFactory authenticatedConnFactory; /** The authenticated connection factory. */ protected ConnectionFactory authenticatedConnFactory; private BindRequest bindRequest = null; @@ -186,25 +179,63 @@ private LDAPOptions options; /** * Default constructor to create a connection factory designed for use with command line tools. * * @param argumentParser * The argument parser. * @param app * The console application linked to this connection factory. * @throws ArgumentException * If an error occurs during parsing the arguments. */ public ConnectionFactoryProvider(final ArgumentParser argumentParser, final ConsoleApplication app) throws ArgumentException { this(argumentParser, app, "cn=Directory Manager", 389, false, null); this(argumentParser, app, "cn=Directory Manager", DEFAULT_LDAP_PORT, false, null); } /** * Default constructor to create a connection factory designed for use with command line tools. * * @param argumentParser * The argument parser. * @param app * The console application linked to this connection factory. * @param options * The common options for this LDAP client connection. * @throws ArgumentException * If an error occurs during parsing the arguments. */ public ConnectionFactoryProvider(final ArgumentParser argumentParser, final ConsoleApplication app, final LDAPOptions options) throws ArgumentException { this(argumentParser, app, "cn=Directory Manager", 389, false, options); this(argumentParser, app, "cn=Directory Manager", DEFAULT_LDAP_PORT, false, options); } /** * Constructor to create a connection factory designed for use with command line tools. * * @param argumentParser * The argument parser. * @param app * The console application linked to this connection factory. * @param defaultBindDN * The bind DN default's value. * @param defaultPort * The LDAP port default's value. * @param alwaysSSL * {@code true} if this connection should be used with SSL. * @param options * The LDAP options of this connection factory. * @throws ArgumentException * If an error occurs during parsing the elements. */ public ConnectionFactoryProvider(final ArgumentParser argumentParser, final ConsoleApplication app, final String defaultBindDN, final int defaultPort, final boolean alwaysSSL, final LDAPOptions options) throws ArgumentException { this.app = app; this.options = options == null ? new LDAPOptions() : options; useSSLArg = new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL, OPTION_LONG_USE_SSL, INFO_DESCRIPTION_USE_SSL.get()); useSSLArg.setPropertyName(OPTION_LONG_USE_SSL); useSSLArg = CommonArguments.getUseSSL(); if (!alwaysSSL) { argumentParser.addLdapConnectionArgument(useSSLArg); } else { @@ -212,10 +243,7 @@ useSSLArg.setPresent(true); } useStartTLSArg = new BooleanArgument("startTLS", OPTION_SHORT_START_TLS, OPTION_LONG_START_TLS, INFO_DESCRIPTION_START_TLS.get()); useStartTLSArg.setPropertyName(OPTION_LONG_START_TLS); useStartTLSArg = CommonArguments.getStartTLS(); if (!alwaysSSL) { argumentParser.addLdapConnectionArgument(useStartTLSArg); } @@ -226,11 +254,7 @@ } catch (final Exception e) { defaultHostName = "Unknown (" + e + ")"; } hostNameArg = new StringArgument("host", OPTION_SHORT_HOST, OPTION_LONG_HOST, false, false, true, INFO_HOST_PLACEHOLDER.get(), defaultHostName, null, INFO_DESCRIPTION_HOST .get()); hostNameArg.setPropertyName(OPTION_LONG_HOST); hostNameArg = CommonArguments.getHostName(defaultHostName); argumentParser.addLdapConnectionArgument(hostNameArg); LocalizableMessage portDescription = INFO_DESCRIPTION_PORT.get(); @@ -238,104 +262,46 @@ portDescription = INFO_DESCRIPTION_ADMIN_PORT.get(); } portArg = new IntegerArgument("port", OPTION_SHORT_PORT, OPTION_LONG_PORT, false, false, true, INFO_PORT_PLACEHOLDER.get(), defaultPort, null, portDescription); portArg.setPropertyName(OPTION_LONG_PORT); portArg = CommonArguments.getPort(defaultPort, portDescription); argumentParser.addLdapConnectionArgument(portArg); bindNameArg = new StringArgument("bindDN", OPTION_SHORT_BINDDN, OPTION_LONG_BINDDN, false, false, true, INFO_BINDDN_PLACEHOLDER.get(), defaultBindDN, null, INFO_DESCRIPTION_BINDDN.get()); bindNameArg.setPropertyName(OPTION_LONG_BINDDN); bindNameArg = CommonArguments.getBindDN(defaultBindDN); argumentParser.addLdapConnectionArgument(bindNameArg); bindPasswordArg = new StringArgument("bindPassword", OPTION_SHORT_BINDPWD, OPTION_LONG_BINDPWD, false, false, true, INFO_BINDPWD_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_BINDPASSWORD.get()); bindPasswordArg.setPropertyName(OPTION_LONG_BINDPWD); bindPasswordArg = CommonArguments.getBindPassword(); argumentParser.addLdapConnectionArgument(bindPasswordArg); bindPasswordFileArg = new FileBasedArgument("bindPasswordFile", OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_BINDPWD_FILE, false, false, INFO_BINDPWD_FILE_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_BINDPASSWORDFILE.get()); bindPasswordFileArg.setPropertyName(OPTION_LONG_BINDPWD_FILE); bindPasswordFileArg = CommonArguments.getBindPasswordFile(); argumentParser.addLdapConnectionArgument(bindPasswordFileArg); saslOptionArg = new StringArgument("sasloption", OPTION_SHORT_SASLOPTION, OPTION_LONG_SASLOPTION, false, true, true, INFO_SASL_OPTION_PLACEHOLDER.get(), null, null, INFO_LDAP_CONN_DESCRIPTION_SASLOPTIONS.get()); saslOptionArg.setPropertyName(OPTION_LONG_SASLOPTION); saslOptionArg = CommonArguments.getSASL(); argumentParser.addLdapConnectionArgument(saslOptionArg); trustAllArg = new BooleanArgument("trustAll", OPTION_SHORT_TRUSTALL, OPTION_LONG_TRUSTALL, INFO_DESCRIPTION_TRUSTALL.get()); trustAllArg.setPropertyName(OPTION_LONG_TRUSTALL); trustAllArg = CommonArguments.getTrustAll(); argumentParser.addLdapConnectionArgument(trustAllArg); trustStorePathArg = new StringArgument("trustStorePath", OPTION_SHORT_TRUSTSTOREPATH, OPTION_LONG_TRUSTSTOREPATH, false, false, true, INFO_TRUSTSTOREPATH_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_TRUSTSTOREPATH.get()); trustStorePathArg.setPropertyName(OPTION_LONG_TRUSTSTOREPATH); trustStorePathArg = CommonArguments.getTrustStorePath(); argumentParser.addLdapConnectionArgument(trustStorePathArg); trustStorePasswordArg = new StringArgument("trustStorePassword", OPTION_SHORT_TRUSTSTORE_PWD, OPTION_LONG_TRUSTSTORE_PWD, false, false, true, INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get()); trustStorePasswordArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD); trustStorePasswordArg = CommonArguments.getTrustStorePassword(); argumentParser.addLdapConnectionArgument(trustStorePasswordArg); trustStorePasswordFileArg = new FileBasedArgument("trustStorePasswordFile", OPTION_SHORT_TRUSTSTORE_PWD_FILE, OPTION_LONG_TRUSTSTORE_PWD_FILE, false, false, INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get()); trustStorePasswordFileArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD_FILE); trustStorePasswordFileArg = CommonArguments.getTrustStorePasswordFile(); argumentParser.addLdapConnectionArgument(trustStorePasswordFileArg); keyStorePathArg = new StringArgument("keyStorePath", OPTION_SHORT_KEYSTOREPATH, OPTION_LONG_KEYSTOREPATH, false, false, true, INFO_KEYSTOREPATH_PLACEHOLDER .get(), null, null, INFO_DESCRIPTION_KEYSTOREPATH.get()); keyStorePathArg.setPropertyName(OPTION_LONG_KEYSTOREPATH); keyStorePathArg = CommonArguments.getKeyStorePath(); argumentParser.addLdapConnectionArgument(keyStorePathArg); keyStorePasswordArg = new StringArgument("keyStorePassword", OPTION_SHORT_KEYSTORE_PWD, OPTION_LONG_KEYSTORE_PWD, false, false, true, INFO_KEYSTORE_PWD_PLACEHOLDER .get(), null, null, INFO_DESCRIPTION_KEYSTOREPASSWORD.get()); keyStorePasswordArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD); keyStorePasswordArg = CommonArguments.getKeyStorePassword(); argumentParser.addLdapConnectionArgument(keyStorePasswordArg); keyStorePasswordFileArg = new FileBasedArgument("keystorePasswordFile", OPTION_SHORT_KEYSTORE_PWD_FILE, OPTION_LONG_KEYSTORE_PWD_FILE, false, false, INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_KEYSTOREPASSWORD_FILE.get()); keyStorePasswordFileArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD_FILE); keyStorePasswordFileArg = CommonArguments.getKeyStorePasswordFile(); argumentParser.addLdapConnectionArgument(keyStorePasswordFileArg); certNicknameArg = new StringArgument("certNickname", OPTION_SHORT_CERT_NICKNAME, OPTION_LONG_CERT_NICKNAME, false, false, true, INFO_NICKNAME_PLACEHOLDER .get(), null, null, INFO_DESCRIPTION_CERT_NICKNAME.get()); certNicknameArg.setPropertyName(OPTION_LONG_CERT_NICKNAME); certNicknameArg = CommonArguments.getCertNickName(); argumentParser.addLdapConnectionArgument(certNicknameArg); reportAuthzIDArg = new BooleanArgument("reportauthzid", 'E', OPTION_LONG_REPORT_AUTHZ_ID, INFO_DESCRIPTION_REPORT_AUTHZID.get()); reportAuthzIDArg.setPropertyName(OPTION_LONG_REPORT_AUTHZ_ID); reportAuthzIDArg = CommonArguments.getReportAuthzId(); argumentParser.addArgument(reportAuthzIDArg); usePasswordPolicyControlArg = @@ -345,6 +311,13 @@ argumentParser.addArgument(usePasswordPolicyControlArg); } /** * Returns the connection factory. * * @return The connection factory. * @throws ArgumentException * If an error occurs during the parsing of the arguments. */ public ConnectionFactory getConnectionFactory() throws ArgumentException { if (connFactory == null) { port = portArg.getIntValue(); @@ -450,13 +423,19 @@ return connFactory; } /** * Returns the authenticated connection factory. * * @return The authenticated connection factory. * @throws ArgumentException * If an error occurs during parsing the arguments. */ public ConnectionFactory getAuthenticatedConnectionFactory() throws ArgumentException { if (authenticatedConnFactory == null) { authenticatedConnFactory = getConnectionFactory(); BindRequest bindRequest = getBindRequest(); final BindRequest bindRequest = getBindRequest(); if (bindRequest != null) { authenticatedConnFactory = new AuthenticatedConnectionFactory(authenticatedConnFactory, bindRequest); authenticatedConnFactory = newAuthenticatedConnectionFactory(authenticatedConnFactory, bindRequest); } } return authenticatedConnFactory; @@ -535,6 +514,13 @@ return value; } /** * Returns the bind request for this connection. * * @return The bind request for this connection. * @throws ArgumentException * If the arguments of this connection are wrong. */ public BindRequest getBindRequest() throws ArgumentException { if (bindRequest == null) { String mech = null; @@ -787,4 +773,11 @@ return option.substring(equalPos + 1, option.length()); } /** {@inheritDoc} */ @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return null; } } opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java
File was renamed from opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java @@ -22,11 +22,11 @@ * * * Copyright 2008-2010 Sun Microsystems, Inc. * Portions copyright 2014 ForgeRock AS */ package com.forgerock.opendj.cli; package com.forgerock.opendj.ldap.tools; import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; import static com.forgerock.opendj.cli.CliMessages.*; import java.io.File; import java.io.FileInputStream; @@ -50,9 +50,6 @@ import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.util.Reject; import com.forgerock.opendj.cli.ClientException; import com.forgerock.opendj.cli.ConsoleApplication; /** * A trust manager which prompts the user for the length of time that they would * like to trust a server certificate. @@ -103,12 +100,12 @@ } } static private final Logger LOG = Logger.getLogger(PromptingTrustManager.class.getName()); private static final Logger LOG = Logger.getLogger(PromptingTrustManager.class.getName()); static private final String DEFAULT_PATH = System.getProperty("user.home") + File.separator private static final String DEFAULT_PATH = System.getProperty("user.home") + File.separator + ".opendj" + File.separator + "keystore"; static private final char[] DEFAULT_PASSWORD = "OpenDJ".toCharArray(); private static final char[] DEFAULT_PASSWORD = "OpenDJ".toCharArray(); private final KeyStore inMemoryTrustStore; opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -42,6 +42,7 @@ import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.ArgumentException; @@ -393,7 +394,14 @@ try { setDefaultPerfToolProperties(); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; runner = new BindPerformanceRunner(argParser, this); propertiesFileArgument = CommonArguments.getPropertiesFile(); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java
@@ -22,7 +22,7 @@ * * * Copyright 2009-2010 Sun Microsystems, Inc. * Portions copyright 2011-2012 ForgeRock AS. * Portions copyright 2011-2014 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
@@ -50,6 +50,7 @@ import org.forgerock.opendj.ldap.controls.AssertionRequestControl; import org.forgerock.opendj.ldap.controls.Control; import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.CompareRequest; import org.forgerock.opendj.ldap.requests.Requests; import org.forgerock.opendj.ldap.responses.Result; @@ -58,6 +59,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.IntegerArgument; import com.forgerock.opendj.cli.StringArgument; @@ -145,7 +147,14 @@ BooleanArgument noPropertiesFileArgument; try { connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; propertiesFileArgument = CommonArguments.getPropertiesFile(); argParser.addArgument(propertiesFileArgument); @@ -155,19 +164,10 @@ argParser.addArgument(noPropertiesFileArgument); argParser.setNoPropertiesFileArgument(noPropertiesFileArgument); filename = new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME, false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null, INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get()); filename.setPropertyName(OPTION_LONG_FILENAME); filename = CommonArguments.getFilename(INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get()); argParser.addArgument(filename); proxyAuthzID = new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID, OPTION_LONG_PROXYAUTHID, false, false, true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_PROXY_AUTHZID.get()); proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID); proxyAuthzID = CommonArguments.getProxyAuthId(); argParser.addArgument(proxyAuthzID); assertionFilter = @@ -177,30 +177,19 @@ assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE); argParser.addArgument(assertionFilter); controlStr = new StringArgument("control", 'J', "control", false, true, true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_CONTROLS.get()); controlStr.setPropertyName("control"); controlStr = CommonArguments.getControl(); argParser.addArgument(controlStr); version = CommonArguments.getVersion(); argParser.addArgument(version); encodingStr = new StringArgument("encoding", 'i', "encoding", false, false, true, INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING .get()); encodingStr.setPropertyName("encoding"); encodingStr = CommonArguments.getEncoding(); argParser.addArgument(encodingStr); continueOnError = CommonArguments.getContinueOnError(); argParser.addArgument(continueOnError); noop = new BooleanArgument("no-op", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get()); noop.setPropertyName(OPTION_LONG_DRYRUN); noop = CommonArguments.getNoOp(); argParser.addArgument(noop); verbose = CommonArguments.getVerbose(); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -56,6 +56,7 @@ import org.forgerock.opendj.ldap.controls.PreReadResponseControl; import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl; import org.forgerock.opendj.ldap.requests.AddRequest; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.DeleteRequest; import org.forgerock.opendj.ldap.requests.ModifyDNRequest; import org.forgerock.opendj.ldap.requests.ModifyRequest; @@ -71,6 +72,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.IntegerArgument; import com.forgerock.opendj.cli.StringArgument; @@ -265,7 +267,14 @@ BooleanArgument noPropertiesFileArgument; try { connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; propertiesFileArgument = CommonArguments.getPropertiesFile(); argParser.addArgument(propertiesFileArgument); @@ -336,10 +345,7 @@ continueOnError = CommonArguments.getContinueOnError(); argParser.addArgument(continueOnError); noop = new BooleanArgument("no-op", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get()); noop.setPropertyName(OPTION_LONG_DRYRUN); noop = CommonArguments.getNoOp(); argParser.addArgument(noop); verbose = CommonArguments.getVerbose(); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -37,6 +37,7 @@ import org.forgerock.opendj.ldap.ErrorResultException; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.controls.Control; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest; import org.forgerock.opendj.ldap.requests.Requests; import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult; @@ -45,6 +46,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.FileBasedArgument; import com.forgerock.opendj.cli.IntegerArgument; @@ -111,7 +113,14 @@ BooleanArgument noPropertiesFileArgument; try { connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; propertiesFileArgument = CommonArguments.getPropertiesFile(); argParser.addArgument(propertiesFileArgument); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -68,6 +68,7 @@ import org.forgerock.opendj.ldap.controls.SimplePagedResultsControl; import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl; import org.forgerock.opendj.ldap.controls.VirtualListViewResponseControl; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.Requests; import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.responses.Result; @@ -80,6 +81,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.IntegerArgument; import com.forgerock.opendj.cli.MultiChoiceArgument; @@ -261,7 +263,14 @@ StringArgument assertionFilter; IntegerArgument sizeLimit; try { connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; final StringArgument propertiesFileArgument = CommonArguments.getPropertiesFile(); argParser.addArgument(propertiesFileArgument); @@ -419,10 +428,7 @@ final BooleanArgument continueOnError = CommonArguments.getContinueOnError(); argParser.addArgument(continueOnError); noop = new BooleanArgument("noop", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get()); noop.setPropertyName(OPTION_LONG_DRYRUN); noop = CommonArguments.getNoOp(); argParser.addArgument(noop); verbose = CommonArguments.getVerbose(); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
@@ -36,6 +36,7 @@ import org.forgerock.opendj.ldap.FutureResult; import org.forgerock.opendj.ldap.ModificationType; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.ModifyRequest; import org.forgerock.opendj.ldap.requests.Requests; import org.forgerock.opendj.ldap.responses.Result; @@ -44,6 +45,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.StringArgument; @@ -172,7 +174,14 @@ try { Utils.setDefaultPerfToolProperties(); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; runner = new ModifyPerformanceRunner(argParser, this); propertiesFileArgument = CommonArguments.getPropertiesFile(); opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
@@ -43,6 +43,7 @@ import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.SearchResultHandler; import org.forgerock.opendj.ldap.SearchScope; import org.forgerock.opendj.ldap.requests.BindRequest; import org.forgerock.opendj.ldap.requests.Requests; import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.responses.Result; @@ -53,6 +54,7 @@ import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.MultiChoiceArgument; import com.forgerock.opendj.cli.StringArgument; @@ -215,7 +217,14 @@ try { Utils.setDefaultPerfToolProperties(); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this) { @Override public ConnectionFactory newAuthenticatedConnectionFactory(final ConnectionFactory connection, final BindRequest request) throws ArgumentException { return new AuthenticatedConnectionFactory(connection, request); } }; runner = new SearchPerformanceRunner(argParser, this); propertiesFileArgument = CommonArguments.getPropertiesFile(); opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProviderTest.java
@@ -37,6 +37,7 @@ import org.testng.annotations.Test; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; @SuppressWarnings("javadoc")