mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
06.18.2014 56f361f30deec1a6d3579bcc32607fe5b12ca636
Checkpoint for OPENDJ-1303 "opendj-cli"
- Added static final readPassword() to ConsoleApplication.
- Added messages.
- Added to CliConstants GLOBAL_ADMIN_UID && DEFAULT_ADMINISTRATION_CONNECTOR_PORT

3 files modified
35 ■■■■■ changed files
opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java 22 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java
@@ -61,6 +61,12 @@
    /** Default name of root user DN. */
    public static final String DEFAULT_ROOT_USER_DN = "cn=Directory Manager";
    /** Default Administration Connector port. */
    public static final int DEFAULT_ADMINISTRATION_CONNECTOR_PORT = 4444;
    /** Default Administration UID. */
    public static final String GLOBAL_ADMIN_UID = "admin";
    // Prevent instantiation.
    private CliConstants() {
opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
@@ -36,6 +36,7 @@
import java.io.BufferedReader;
import java.io.Console;
import java.io.EOFException;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -494,6 +495,27 @@
    }
    /**
     * Reads a password from the console without echoing it to the client.
     * FIXME This method should disappear when all
     * the tools will extend to ConsoleApplication.
     *
     * @return The password as an array of characters.
     * @throws ClientException
     *             If an error occurs when reading the password.
     */
    public static final char[] readPassword() throws ClientException {
        try {
            char[] password = System.console().readPassword();
            if (password != null) {
                return password;
            }
        } catch (IOError e) {
            throw ClientException.adaptInputException(e);
        }
        return null;
    }
    /**
     * Interactively retrieves a line of input from the console.
     *
     * @param prompt
opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
@@ -456,7 +456,11 @@
INFO_TRUST_MANAGER_PROVIDER_DN_PLACEHOLDER={trustManagerProviderDN}
INFO_SERVER_ROOT_DIR_PLACEHOLDER={serverRootDir}
INFO_SERVICE_NAME_PLACEHOLDER={serviceName}
INFO_VALUE_SET_PLACEHOLDER={PROP:VALUE}
INFO_TYPE_PLACEHOLDER={type}
INFO_CATEGORY_PLACEHOLDER={category}
INFO_PSEARCH_PLACEHOLDER=ps[:changetype[:changesonly[:entrychgcontrols]]]
INFO_ADMINUID_PLACEHOLDER={adminUID}
ERR_CANNOT_READ_TRUSTSTORE=Cannot access trust store '%s'.  Verify \
 that the provided trust store exists and that you have read access rights to it
ERR_CANNOT_READ_KEYSTORE=Cannot access key store '%s'.  Verify \
@@ -843,4 +847,7 @@
INFO_DESCRIPTION_IMPORTLDIF=Path to an LDIF file \
 containing data that should be added to the Directory Server database. \
 Multiple LDIF files may be provided by using this option multiple times
INFO_LDAPAUTH_PASSWORD_PROMPT=Password for user '%s':
INFO_DESCRIPTION_ADMIN_UID=User ID of the Global Administrator \
 to use to bind to the server