@Extensible @ThreadSafety(level=INTERFACE_NOT_THREADSAFE) public abstract class MultiServerLDAPCommandLineTool extends CommandLineTool
Constructor and Description |
---|
MultiServerLDAPCommandLineTool(java.io.OutputStream outStream,
java.io.OutputStream errStream,
java.lang.String[] serverNamePrefixes,
java.lang.String[] serverNameSuffixes)
Creates a new instance of this multi-server LDAP command-line tool.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addNonLDAPArguments(ArgumentParser parser)
Adds the arguments needed by this command-line tool to the provided
argument parser which are not related to connecting or authenticating to
the directory server.
|
void |
addToolArguments(ArgumentParser parser)
Adds the command-line arguments supported for use with this tool to the
provided argument parser.
|
BindRequest |
createBindRequest(int serverIndex)
Creates the bind request to use to authenticate to the indicated server.
|
ServerSet |
createServerSet(int serverIndex)
Creates the server set to use when creating connections or connection
pools.
|
SSLUtil |
createSSLUtil(int serverIndex)
Creates the SSLUtil instance to use for secure communication.
|
void |
doExtendedArgumentValidation()
Performs any necessary processing that should be done to ensure that the
provided set of command-line arguments were valid.
|
void |
doExtendedNonLDAPArgumentValidation()
Performs any necessary processing that should be done to ensure that the
provided set of command-line arguments were valid.
|
LDAPConnection |
getConnection(int serverIndex)
Retrieves a connection that may be used to communicate with the indicated
directory server.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the connection options that should be used for connections that
are created with this command line tool.
|
LDAPConnectionPool |
getConnectionPool(int serverIndex,
int initialConnections,
int maxConnections)
Retrieves a connection pool that may be used to communicate with the
indicated directory server.
|
LDAPConnection |
getUnauthenticatedConnection(int serverIndex)
Retrieves an unauthenticated connection that may be used to communicate
with the indicated directory server.
|
protected boolean |
includeAlternateLongIdentifiers()
Indicates whether the LDAP-specific arguments should include alternate
versions of all long identifiers that consist of multiple words so that
they are available in both camelCase and dash-separated versions.
|
addEnableSSLDebuggingArgument, createArgumentParser, defaultsToInteractiveMode, doShutdownHookProcessing, doToolProcessing, err, getAdditionalDescriptionParagraphs, getErr, getExampleUsages, getMaxTrailingArguments, getMinTrailingArguments, getOriginalErr, getOriginalOut, getOut, getPasswordFileReader, getToolCompletionMessage, getToolDescription, getToolName, getToolVersion, getTrailingArgumentsPlaceholder, logToolInvocationByDefault, out, registerShutdownHook, requestToolArgumentsInteractively, runTool, supportsDebugLogging, supportsInteractiveMode, supportsOutputFile, supportsPropertiesFile, wrapErr, wrapOut
public MultiServerLDAPCommandLineTool(@Nullable java.io.OutputStream outStream, @Nullable java.io.OutputStream errStream, @Nullable java.lang.String[] serverNamePrefixes, @Nullable java.lang.String[] serverNameSuffixes) throws LDAPSDKUsageException
null
. If both are non-null
, then they must have the
same number of elements.outStream
- The output stream to use for standard output.
It may be System.out
for the JVM's
default standard output stream, null
if
no output should be generated, or a custom
output stream if the output should be sent to
an alternate location.errStream
- The output stream to use for standard error.
It may be System.err
for the JVM's
default standard error stream, null
if
no output should be generated, or a custom
output stream if the output should be sent to
an alternate location.serverNamePrefixes
- The prefixes to include before the names of
each of the parameters to identify each server.
It may be null
if only suffixes should
be used.serverNameSuffixes
- The suffixes to include after the names of each
of the parameters to identify each server. It
may be null
if only prefixes should be
used.LDAPSDKUsageException
- If both the sets of server name prefixes
and suffixes are null
or empty, or
if both sets are non-null
but have
different numbers of elements.public final void addToolArguments(@NotNull ArgumentParser parser) throws ArgumentException
addToolArguments
in class CommandLineTool
parser
- The argument parser to which the arguments are to be added.ArgumentException
- If a problem occurs while adding any of the
tool-specific arguments to the provided
argument parser.protected boolean includeAlternateLongIdentifiers()
true
if this tool should provide multiple versions of
long identifiers for LDAP-specific arguments, or false
if
not.public abstract void addNonLDAPArguments(@NotNull ArgumentParser parser) throws ArgumentException
parser
- The argument parser to which the arguments should be added.ArgumentException
- If a problem occurs while adding the arguments.public final void doExtendedArgumentValidation() throws ArgumentException
CommandLineTool.doToolProcessing()
method is invoked.
Note that if the tool supports interactive mode, then this method may be
invoked multiple times to allow the user to interactively fix validation
errors.doExtendedArgumentValidation
in class CommandLineTool
ArgumentException
- If there was a problem with the command-line
arguments provided to this program.public void doExtendedNonLDAPArgumentValidation() throws ArgumentException
CommandLineTool.doToolProcessing()
method is invoked.ArgumentException
- If there was a problem with the command-line
arguments provided to this program.@NotNull public LDAPConnectionOptions getConnectionOptions()
@ThreadSafety(level=METHOD_THREADSAFE) @NotNull public final LDAPConnection getConnection(int serverIndex) throws LDAPException
CommandLineTool.doToolProcessing()
method.serverIndex
- The zero-based index of the server to which the
connection should be established.LDAPException
- If a problem occurs while creating the connection.@ThreadSafety(level=METHOD_THREADSAFE) @NotNull public final LDAPConnection getUnauthenticatedConnection(int serverIndex) throws LDAPException
CommandLineTool.doToolProcessing()
method.serverIndex
- The zero-based index of the server to which the
connection should be established.LDAPException
- If a problem occurs while creating the connection.@ThreadSafety(level=METHOD_THREADSAFE) @NotNull public final LDAPConnectionPool getConnectionPool(int serverIndex, int initialConnections, int maxConnections) throws LDAPException
CommandLineTool.doToolProcessing()
method.serverIndex
- The zero-based index of the server to which the
connection should be established.initialConnections
- The number of connections that should be
initially established in the pool.maxConnections
- The maximum number of connections to maintain
in the pool.LDAPException
- If a problem occurs while creating the connection
pool.@NotNull public final ServerSet createServerSet(int serverIndex) throws LDAPException
serverIndex
- The zero-based index of the server to which the
connection should be established.LDAPException
- If a problem occurs while creating the server set.@Nullable public final SSLUtil createSSLUtil(int serverIndex) throws LDAPException
serverIndex
- The zero-based index of the server to which the
connection should be established.null
if secure communication is not needed.LDAPException
- If a problem occurs while creating the SSLUtil
instance.@Nullable public final BindRequest createBindRequest(int serverIndex) throws LDAPException
serverIndex
- The zero-based index of the server to which the
connection should be established.null
if no bind should be performed.LDAPException
- If a problem occurs while creating the bind
request.