org.opends.server.admin.client.cli
Class SecureConnectionCliArgs

java.lang.Object
  extended by org.opends.server.admin.client.cli.SecureConnectionCliArgs

public final class SecureConnectionCliArgs
extends java.lang.Object

This is a commodity class that can be used to check the arguments required to establish a secure connection in the command line. It can be used to generate an ApplicationTrustManager object based on the options provided by the user in the command line.


Field Summary
 StringArgument adminUidArg
          The 'adminUID' global argument.
 StringArgument bindDnArg
          The 'bindDN' global argument.
 StringArgument bindPasswordArg
          The 'bindPassword' global argument.
 FileBasedArgument bindPasswordFileArg
          The 'bindPasswordFile' global argument.
 StringArgument certNicknameArg
          The 'certNicknameArg' global argument.
static java.lang.String EOL
          End Of Line.
 StringArgument hostNameArg
          The 'hostName' global argument.
 StringArgument keyStorePasswordArg
          The 'keyStorePassword' global argument.
 FileBasedArgument keyStorePasswordFileArg
          The 'keyStorePasswordFile' global argument.
 StringArgument keyStorePathArg
          The 'keyStore' global argument.
 IntegerArgument portArg
          The 'port' global argument.
 StringArgument saslOptionArg
          Argument indicating a SASL option.
 BooleanArgument trustAllArg
          The 'trustAllArg' global argument.
 StringArgument trustStorePasswordArg
          The 'trustStorePassword' global argument.
 FileBasedArgument trustStorePasswordFileArg
          The 'trustStorePasswordFile' global argument.
 StringArgument trustStorePathArg
          The 'trustStore' global argument.
 BooleanArgument useSSLArg
          The 'useSSLArg' global argument.
 BooleanArgument useStartTLSArg
          The 'useStartTLSArg' global argument.
 
Constructor Summary
SecureConnectionCliArgs()
          Creates a new instance of secure arguments.
 
Method Summary
 boolean argumentsPresent()
          Indicates whether or not any of the arguments are present.
 java.util.LinkedHashSet<Argument> createGlobalArguments()
          Initialize Global option.
 java.lang.String getAdministratorUID()
          Get the admin UID which has to be used for the command.
 java.lang.String getBindDN()
          Get the bindDN which has to be used for the command.
 java.lang.String getBindPassword()
          Get the password which has to be used for the command without prompting the user.
 java.lang.String getBindPassword(StringArgument clearArg, FileBasedArgument fileArg)
          Get the password which has to be used for the command without prompting the user.
 java.lang.String getBindPassword(java.lang.String dn, java.io.OutputStream out, java.io.OutputStream err)
          Get the password which has to be used for the command.
 java.lang.String getBindPassword(java.lang.String dn, java.io.OutputStream out, java.io.OutputStream err, StringArgument clearArg, FileBasedArgument fileArg)
          Get the password which has to be used for the command.
 java.lang.String getHostName()
          Get the host name which has to be used for the command.
 javax.net.ssl.KeyManager getKeyManager()
          Handle KeyStore.
 java.lang.String getPort()
          Get the port which has to be used for the command.
 ApplicationTrustManager getTrustManager()
          Handle TrustStore.
 boolean useAdminUID()
          Tells whether this parser uses the Administrator UID (instead of the bind DN) or not.
 boolean useSSL()
          Indicate if the SSL mode is required.
 boolean useStartTLS()
          Indicate if the startTLS mode is required.
 int validateGlobalOptions(MessageBuilder buf)
          Indication if provided global options are validate.
 int validateGlobalOptions(java.io.PrintStream err)
          Indication if provided global options are validate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hostNameArg

public StringArgument hostNameArg
The 'hostName' global argument.


portArg

public IntegerArgument portArg
The 'port' global argument.


bindDnArg

public StringArgument bindDnArg
The 'bindDN' global argument.


adminUidArg

public StringArgument adminUidArg
The 'adminUID' global argument.


bindPasswordFileArg

public FileBasedArgument bindPasswordFileArg
The 'bindPasswordFile' global argument.


bindPasswordArg

public StringArgument bindPasswordArg
The 'bindPassword' global argument.


trustAllArg

public BooleanArgument trustAllArg
The 'trustAllArg' global argument.


trustStorePathArg

public StringArgument trustStorePathArg
The 'trustStore' global argument.


trustStorePasswordArg

public StringArgument trustStorePasswordArg
The 'trustStorePassword' global argument.


trustStorePasswordFileArg

public FileBasedArgument trustStorePasswordFileArg
The 'trustStorePasswordFile' global argument.


keyStorePathArg

public StringArgument keyStorePathArg
The 'keyStore' global argument.


keyStorePasswordArg

public StringArgument keyStorePasswordArg
The 'keyStorePassword' global argument.


keyStorePasswordFileArg

public FileBasedArgument keyStorePasswordFileArg
The 'keyStorePasswordFile' global argument.


certNicknameArg

public StringArgument certNicknameArg
The 'certNicknameArg' global argument.


useSSLArg

public BooleanArgument useSSLArg
The 'useSSLArg' global argument.


useStartTLSArg

public BooleanArgument useStartTLSArg
The 'useStartTLSArg' global argument.


saslOptionArg

public StringArgument saslOptionArg
Argument indicating a SASL option.


EOL

public static java.lang.String EOL
End Of Line.

Constructor Detail

SecureConnectionCliArgs

public SecureConnectionCliArgs()
Creates a new instance of secure arguments.

Method Detail

argumentsPresent

public boolean argumentsPresent()
Indicates whether or not any of the arguments are present.

Returns:
boolean where true indicates that at least one of the arguments is present

getAdministratorUID

public java.lang.String getAdministratorUID()
Get the admin UID which has to be used for the command.

Returns:
The admin UID specified by the command line argument, or the default value, if not specified.

useAdminUID

public boolean useAdminUID()
Tells whether this parser uses the Administrator UID (instead of the bind DN) or not.

Returns:
true if this parser uses the Administrator UID and false otherwise.

getBindDN

public java.lang.String getBindDN()
Get the bindDN which has to be used for the command.

Returns:
The bindDN specified by the command line argument, or the default value, if not specified.

getBindPassword

public java.lang.String getBindPassword(java.lang.String dn,
                                        java.io.OutputStream out,
                                        java.io.OutputStream err,
                                        StringArgument clearArg,
                                        FileBasedArgument fileArg)
Get the password which has to be used for the command.

Parameters:
dn - The user DN for which to password could be asked.
out - The input stream to used if we have to prompt to the user.
err - The error stream to used if we have to prompt to the user.
clearArg - The password StringArgument argument.
fileArg - The password FileBased argument.
Returns:
The password stored into the specified file on by the command line argument, or prompts it if not specified.

getBindPassword

public java.lang.String getBindPassword(java.lang.String dn,
                                        java.io.OutputStream out,
                                        java.io.OutputStream err)
Get the password which has to be used for the command.

Parameters:
dn - The user DN for which to password could be asked.
out - The input stream to used if we have to prompt to the user.
err - The error stream to used if we have to prompt to the user.
Returns:
The password stored into the specified file on by the command line argument, or prompts it if not specified.

getBindPassword

public java.lang.String getBindPassword(StringArgument clearArg,
                                        FileBasedArgument fileArg)
Get the password which has to be used for the command without prompting the user. If no password was specified, return null.

Parameters:
clearArg - The password StringArgument argument.
fileArg - The password FileBased argument.
Returns:
The password stored into the specified file on by the command line argument, or null it if not specified.

getBindPassword

public java.lang.String getBindPassword()
Get the password which has to be used for the command without prompting the user. If no password was specified, return null.

Returns:
The password stored into the specified file on by the command line argument, or null it if not specified.

createGlobalArguments

public java.util.LinkedHashSet<Argument> createGlobalArguments()
                                                        throws ArgumentException
Initialize Global option.

Returns:
a ArrayList with the options created.
Throws:
ArgumentException - If there is a problem with any of the parameters used to create this argument.

getHostName

public java.lang.String getHostName()
Get the host name which has to be used for the command.

Returns:
The host name specified by the command line argument, or the default value, if not specified.

getPort

public java.lang.String getPort()
Get the port which has to be used for the command.

Returns:
The port specified by the command line argument, or the default value, if not specified.

validateGlobalOptions

public int validateGlobalOptions(MessageBuilder buf)
Indication if provided global options are validate.

Parameters:
buf - the MessageBuilder to write the error messages.
Returns:
return code.

validateGlobalOptions

public int validateGlobalOptions(java.io.PrintStream err)
Indication if provided global options are validate.

Parameters:
err - the stream to be used to print error message.
Returns:
return code.

useSSL

public boolean useSSL()
Indicate if the SSL mode is required.

Returns:
True if SSL mode is required

useStartTLS

public boolean useStartTLS()
Indicate if the startTLS mode is required.

Returns:
True if startTLS mode is required

getTrustManager

public ApplicationTrustManager getTrustManager()
Handle TrustStore.

Returns:
The trustStore manager to be used for the command.

getKeyManager

public javax.net.ssl.KeyManager getKeyManager()
Handle KeyStore.

Returns:
The keyStore manager to be used for the command.