@ThreadSafety(level=NOT_THREADSAFE) public final class MoveSubtree extends MultiServerLDAPCommandLineTool implements UnsolicitedNotificationHandler, MoveSubtreeListener
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
Constructor and Description |
---|
MoveSubtree(java.io.OutputStream out,
java.io.OutputStream err)
Creates a new instance of this tool with the provided output and error
streams.
|
Modifier and Type | Method and Description |
---|---|
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 |
doPostAddProcessing(ReadOnlyEntry entry)
Performs any processing which may be needed after the provided entry has
been added to the target server.
|
void |
doPostDeleteProcessing(DN entryDN)
Performs any processing which may be needed after the specified entry has
been deleted from the source server.
|
ReadOnlyEntry |
doPreAddProcessing(ReadOnlyEntry entry)
Performs any processing which may be needed before the provided entry is
added to the target server.
|
void |
doPreDeleteProcessing(DN entryDN)
Performs any processing which may be needed before the specified entry is
deleted from the source server.
|
protected void |
doShutdownHookProcessing(ResultCode resultCode)
Performs any processing that may be needed when the JVM is shutting down,
whether because tool processing has completed or because it has been
interrupted (e.g., by a kill or break signal).
|
ResultCode |
doToolProcessing()
Performs the core set of processing for this tool.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the connection options that should be used for connections that
are created with this command line tool.
|
java.util.LinkedHashMap<java.lang.String[],java.lang.String> |
getExampleUsages()
Retrieves a set of information that may be used to generate example usage
information.
|
java.lang.String |
getToolDescription()
Retrieves a human-readable description for this tool.
|
java.lang.String |
getToolName()
Retrieves the name of this tool.
|
java.lang.String |
getToolVersion()
Retrieves a version string for this tool, if available.
|
void |
handleUnsolicitedNotification(LDAPConnection connection,
ExtendedResult notification)
Performs any processing that may be necessary in response to the provided
unsolicited notification that has been received from the 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.
|
protected boolean |
logToolInvocationByDefault()
Indicates whether to log messages about the launch and completion of this
tool into the invocation log of Ping Identity server products that may
include it.
|
static void |
main(java.lang.String... args)
Parse the provided command line arguments and perform the appropriate
processing.
|
static ResultCode |
main(java.lang.String[] args,
java.io.OutputStream out,
java.io.OutputStream err)
Parse the provided command line arguments and perform the appropriate
processing.
|
static MoveSubtreeResult |
moveEntryWithInteractiveTransaction(LDAPConnection sourceConnection,
LDAPConnection targetConnection,
java.lang.String entryDN,
OperationPurposeRequestControl opPurposeControl,
boolean suppressRefInt,
MoveSubtreeListener listener)
Deprecated.
The use of interactive transactions is strongly discouraged
because it can create conditions which are prone to deadlocks
between operations that may significantly affect performance
and will result in the cancellation of one or both operations.
|
static MoveSubtreeResult |
moveEntryWithInteractiveTransaction(LDAPConnection sourceConnection,
LDAPConnection targetConnection,
java.lang.String entryDN,
OperationPurposeRequestControl opPurposeControl,
MoveSubtreeListener listener)
Deprecated.
The use of interactive transactions is strongly discouraged
because it can create conditions which are prone to deadlocks
between operations that may significantly affect performance
and will result in the cancellation of one or both operations.
|
static MoveSubtreeResult |
moveSubtreeWithRestrictedAccessibility(LDAPConnection sourceConnection,
LDAPConnection targetConnection,
MoveSubtreeProperties properties)
Moves a subtree of entries using a process in which access to the subtree
will be restricted while the move is in progress.
|
static MoveSubtreeResult |
moveSubtreeWithRestrictedAccessibility(LDAPConnection sourceConnection,
LDAPConnection targetConnection,
java.lang.String baseDN,
int sizeLimit,
OperationPurposeRequestControl opPurposeControl,
boolean suppressRefInt,
MoveSubtreeListener listener)
Moves a subtree of entries using a process in which access to the subtree
will be restricted while the move is in progress.
|
static MoveSubtreeResult |
moveSubtreeWithRestrictedAccessibility(LDAPConnection sourceConnection,
LDAPConnection targetConnection,
java.lang.String baseDN,
int sizeLimit,
OperationPurposeRequestControl opPurposeControl,
MoveSubtreeListener listener)
Moves a subtree of entries using a process in which access to the subtree
will be restricted while the move is in progress.
|
protected boolean |
registerShutdownHook()
Indicates whether this tool should register a shutdown hook with the JVM.
|
protected boolean |
supportsDebugLogging()
Indicates whether this tool supports the ability to generate a debug log
file.
|
protected boolean |
supportsOutputFile()
Indicates whether this tool should provide arguments for redirecting output
to a file.
|
boolean |
supportsPropertiesFile()
Indicates whether this tool supports the use of a properties file for
specifying default values for arguments that aren't specified on the
command line.
|
addToolArguments, createBindRequest, createServerSet, createSSLUtil, doExtendedArgumentValidation, doExtendedNonLDAPArgumentValidation, getConnection, getConnectionPool, getUnauthenticatedConnection
addEnableSSLDebuggingArgument, createArgumentParser, defaultsToInteractiveMode, err, getAdditionalDescriptionParagraphs, getErr, getMaxTrailingArguments, getMinTrailingArguments, getOriginalErr, getOriginalOut, getOut, getPasswordFileReader, getToolCompletionMessage, getTrailingArgumentsPlaceholder, out, requestToolArgumentsInteractively, runTool, supportsInteractiveMode, wrapErr, wrapOut
public MoveSubtree(@Nullable java.io.OutputStream out, @Nullable java.io.OutputStream err)
out
- The output stream to which standard out should be written. It
may be null
if output should be suppressed.err
- The output stream to which standard error should be written.
It may be null
if error messages should be suppressed.public static void main(@NotNull java.lang.String... args)
args
- The command line arguments provided to this program.@NotNull public static ResultCode main(@NotNull java.lang.String[] args, @Nullable java.io.OutputStream out, @Nullable java.io.OutputStream err)
args
- The command line arguments provided to this program.out
- The output stream to which standard out should be written.
It may be null
if output should be suppressed.err
- The output stream to which standard error should be written.
It may be null
if error messages should be
suppressed.@NotNull public java.lang.String getToolName()
getToolName
in class CommandLineTool
@NotNull public java.lang.String getToolDescription()
CommandLineTool.getAdditionalDescriptionParagraphs()
method should be used to
return the text for the subsequent paragraphs.getToolDescription
in class CommandLineTool
@NotNull public java.lang.String getToolVersion()
getToolVersion
in class CommandLineTool
null
if none is
available.protected boolean includeAlternateLongIdentifiers()
includeAlternateLongIdentifiers
in class MultiServerLDAPCommandLineTool
true
if this tool should provide multiple versions of
long identifiers for LDAP-specific arguments, or false
if
not.public void addNonLDAPArguments(@NotNull ArgumentParser parser) throws ArgumentException
addNonLDAPArguments
in class MultiServerLDAPCommandLineTool
parser
- The argument parser to which the arguments should be added.ArgumentException
- If a problem occurs while adding the arguments.@NotNull public LDAPConnectionOptions getConnectionOptions()
getConnectionOptions
in class MultiServerLDAPCommandLineTool
protected boolean supportsOutputFile()
true
, then the tool will offer
an "--outputFile" argument that will specify the path to a file to which
all standard output and standard error content will be written, and it will
also offer a "--teeToStandardOut" argument that can only be used if the
"--outputFile" argument is present and will cause all output to be written
to both the specified output file and to standard output.supportsOutputFile
in class CommandLineTool
true
if this tool should provide arguments for redirecting
output to a file, or false
if not.public boolean supportsPropertiesFile()
supportsPropertiesFile
in class CommandLineTool
true
if this tool supports the use of a properties file
for specifying default values for arguments that aren't specified
on the command line, or false
if not.protected boolean supportsDebugLogging()
true
, then the tool will expose
additional arguments that can control debug logging.supportsDebugLogging
in class CommandLineTool
true
if this tool supports the ability to generate a debug
log file, or false
if not.protected boolean logToolInvocationByDefault()
true
for tools that may alter
the server configuration, data, or other state information, and
false
for tools that do not make any changes.logToolInvocationByDefault
in class CommandLineTool
true
if Ping Identity server products should include
messages about the launch and completion of this tool in tool
invocation log files by default, or false
if not.@NotNull public ResultCode doToolProcessing()
doToolProcessing
in class CommandLineTool
@Deprecated @NotNull public static MoveSubtreeResult moveEntryWithInteractiveTransaction(@NotNull LDAPConnection sourceConnection, @NotNull LDAPConnection targetConnection, @NotNull java.lang.String entryDN, @Nullable OperationPurposeRequestControl opPurposeControl, @Nullable MoveSubtreeListener listener)
NOTE: The use of interactive transactions is strongly discouraged
because it can create conditions which are prone to deadlocks between
operations that may significantly affect performance and will result in
the cancellation of one or both operations. Use one of the
moveSubtreeWithRestrictedAccessibility
methods instead.
Moves a single leaf entry using a pair of interactive transactions. The
logic used to accomplish this is as follows:
sourceConnection
- A connection established to the source server.
It should be authenticated as a user with
permission to perform all of the operations
against the source server as referenced above.targetConnection
- A connection established to the target server.
It should be authenticated as a user with
permission to perform all of the operations
against the target server as referenced above.entryDN
- The base DN for the subtree to move.opPurposeControl
- An optional operation purpose request control
that may be included in all requests sent to the
source and target servers.listener
- An optional listener that may be invoked during
the course of moving entries from the source
server to the target server.@Deprecated @NotNull public static MoveSubtreeResult moveEntryWithInteractiveTransaction(@NotNull LDAPConnection sourceConnection, @NotNull LDAPConnection targetConnection, @NotNull java.lang.String entryDN, @Nullable OperationPurposeRequestControl opPurposeControl, boolean suppressRefInt, @Nullable MoveSubtreeListener listener)
NOTE: The use of interactive transactions is strongly discouraged
because it can create conditions which are prone to deadlocks between
operations that may significantly affect performance and will result in
the cancellation of one or both operations. Use one of the
moveSubtreeWithRestrictedAccessibility
methods instead.
Moves a single leaf entry using a pair of interactive transactions. The
logic used to accomplish this is as follows:
sourceConnection
- A connection established to the source server.
It should be authenticated as a user with
permission to perform all of the operations
against the source server as referenced above.targetConnection
- A connection established to the target server.
It should be authenticated as a user with
permission to perform all of the operations
against the target server as referenced above.entryDN
- The base DN for the subtree to move.opPurposeControl
- An optional operation purpose request control
that may be included in all requests sent to the
source and target servers.suppressRefInt
- Indicates whether to include a request control
causing referential integrity updates to be
suppressed on the source server.listener
- An optional listener that may be invoked during
the course of moving entries from the source
server to the target server.@NotNull public static MoveSubtreeResult moveSubtreeWithRestrictedAccessibility(@NotNull LDAPConnection sourceConnection, @NotNull LDAPConnection targetConnection, @NotNull java.lang.String baseDN, int sizeLimit, @Nullable OperationPurposeRequestControl opPurposeControl, @Nullable MoveSubtreeListener listener)
sourceConnection
- A connection established to the source server.
It should be authenticated as a user with
permission to perform all of the operations
against the source server as referenced above.targetConnection
- A connection established to the target server.
It should be authenticated as a user with
permission to perform all of the operations
against the target server as referenced above.baseDN
- The base DN for the subtree to move.sizeLimit
- The maximum number of entries to be moved. It
may be less than or equal to zero to indicate
that no client-side limit should be enforced
(although the server may still enforce its own
limit).opPurposeControl
- An optional operation purpose request control
that may be included in all requests sent to the
source and target servers.listener
- An optional listener that may be invoked during
the course of moving entries from the source
server to the target server.@NotNull public static MoveSubtreeResult moveSubtreeWithRestrictedAccessibility(@NotNull LDAPConnection sourceConnection, @NotNull LDAPConnection targetConnection, @NotNull java.lang.String baseDN, int sizeLimit, @Nullable OperationPurposeRequestControl opPurposeControl, boolean suppressRefInt, @Nullable MoveSubtreeListener listener)
sourceConnection
- A connection established to the source server.
It should be authenticated as a user with
permission to perform all of the operations
against the source server as referenced above.targetConnection
- A connection established to the target server.
It should be authenticated as a user with
permission to perform all of the operations
against the target server as referenced above.baseDN
- The base DN for the subtree to move.sizeLimit
- The maximum number of entries to be moved. It
may be less than or equal to zero to indicate
that no client-side limit should be enforced
(although the server may still enforce its own
limit).opPurposeControl
- An optional operation purpose request control
that may be included in all requests sent to the
source and target servers.suppressRefInt
- Indicates whether to include a request control
causing referential integrity updates to be
suppressed on the source server.listener
- An optional listener that may be invoked during
the course of moving entries from the source
server to the target server.@NotNull public static MoveSubtreeResult moveSubtreeWithRestrictedAccessibility(@NotNull LDAPConnection sourceConnection, @NotNull LDAPConnection targetConnection, @NotNull MoveSubtreeProperties properties)
sourceConnection
- A connection established to the source server.
It should be authenticated as a user with
permission to perform all of the operations
against the source server as referenced above.targetConnection
- A connection established to the target server.
It should be authenticated as a user with
permission to perform all of the operations
against the target server as referenced above.properties
- A set of properties that indicate how the move
shoudl be performed.public void handleUnsolicitedNotification(@NotNull LDAPConnection connection, @NotNull ExtendedResult notification)
handleUnsolicitedNotification
in interface UnsolicitedNotificationHandler
connection
- The connection on which the unsolicited notification
was received.notification
- The unsolicited notification that has been received
from the server.@NotNull public ReadOnlyEntry doPreAddProcessing(@NotNull ReadOnlyEntry entry)
doPreAddProcessing
in interface MoveSubtreeListener
entry
- A read-only representation of the entry to be added to the
target server.null
if the
entry should not be added to the target server (but will still be
removed from the source server).public void doPostAddProcessing(@NotNull ReadOnlyEntry entry)
doPostAddProcessing
in interface MoveSubtreeListener
entry
- A read-only representation of the entry that was added to
the target server. Note that depending on the algorithm
used to perform the move, the entry may not yet be
accessible in the target server. Also note that the add may
potentially be reverted if move processing encounters an
error later in its processing.public void doPreDeleteProcessing(@NotNull DN entryDN)
doPreDeleteProcessing
in interface MoveSubtreeListener
entryDN
- The DN of the entry that is to be removed from the
source server. Note that depending on the algorithm used
to perform the move, the entry may already be inaccessible
in the source server.public void doPostDeleteProcessing(@NotNull DN entryDN)
doPostDeleteProcessing
in interface MoveSubtreeListener
entryDN
- The DN of the entry that has been removed from the source
server. Note that the delete may potentially be reverted
if move processing encounters an error later in its
processing.protected boolean registerShutdownHook()
System.exit()
or Runtime.exit()
is called.System.halt()
or
Runtime.halt()
methods).
true
, then the
CommandLineTool.doShutdownHookProcessing(ResultCode)
method should also be
overridden to contain the logic that will be invoked when the JVM is
shutting down in a manner that calls shutdown hooks.registerShutdownHook
in class CommandLineTool
true
if this tool should register a shutdown hook, or
false
if not.protected void doShutdownHookProcessing(@Nullable ResultCode resultCode)
java.lang.Runtime.addShutdownHook
method for recommendations and
restrictions about writing shutdown hooks.doShutdownHookProcessing
in class CommandLineTool
resultCode
- The result code returned by the tool. It may be
null
if the tool was interrupted before it
completed processing.@NotNull public java.util.LinkedHashMap<java.lang.String[],java.lang.String> getExampleUsages()
getExampleUsages
in class CommandLineTool
null
or empty if no example usage
information is available.