Class DeleteSubTree
This retries its searches if a size limit error is encountered until all the entries are deleted. Errors are stored up and returned one by one as exceptions from the getException() method, which may be called whilst the delete is in progress from the foreground thread. status(), isFinished(), getEntryCount() and getErrorCount() may be called to monitor the progress of the recursive delete. abort() may be called to abort the operation.
Note that the run() method should be called only within a background thread (e.g. using BackgroundTask), as the code executes directory operations directly and will block waiting for directory operations to complete.
- Author:
- jp
-
Constructor Summary
ConstructorsConstructorDescriptionDeleteSubTree
(DirectorySession ds, DN start, boolean include_start) Initialise the DeleteSubTree to use the given directory session, start point and 'first' flag.DeleteSubTree
(DirectorySession ds, DN start, boolean include_start, boolean useManageDsaIt, DN userDN) Initialise the DeleteSubTree to use the given directory session, start point and 'first' flag. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Abort the operation.int
Return the number of entries deletedint
Return the number of errors noted to date.Returns the next outstanding Exception, or null if there are no more exceptions outstanding.boolean
Test to see if the dump has finished.void
run()
Run the sub-tree delete operation.status()
Get the current status of the operation as a string.
-
Constructor Details
-
DeleteSubTree
Initialise the DeleteSubTree to use the given directory session, start point and 'first' flag. This may be done from a GUI thread.- Parameters:
ds
- DirectorySession to usestart
- DN to start atinclude_start
- Include the starting DN in the deletion?
-
DeleteSubTree
public DeleteSubTree(DirectorySession ds, DN start, boolean include_start, boolean useManageDsaIt, DN userDN) Initialise the DeleteSubTree to use the given directory session, start point and 'first' flag. This may be done from a GUI thread.- Parameters:
ds
- DirectorySession to usestart
- DN to start atinclude_start
- Include the starting DN in the deletion?useManageDsaIt
- TRUE if manageDsaIt should be set to TRUE in common arguments used in DS operationsuserDN
- DN of user who has permissions to delete an admin point; if it is null then admin point deletion would fail- Since:
- 15.0
-
-
Method Details
-
run
public void run()Run the sub-tree delete operation. Non-fatal Exceptions are queued rather than rethrown, so it is important to check for errors after running this method by calling getException().This method must be run from a background (non-GUI) thread as it does directory operations directly and will block whilst waiting for directory data.
-
abort
public void abort()Abort the operation. This may be called from the GUI thread. This will stop the operation at the next available opportunity. Note that if the operation is blocked waiting for a directory result, this cannot be interrupted and the abort will not be processed until the directory operation actually returns. -
status
Get the current status of the operation as a string. This may be called from the GUI thread.- Returns:
- Status of the operation as a string
-
isFinished
public boolean isFinished()Test to see if the dump has finished. This may be called from the GUI thread.- Returns:
- Finished?
-
getException
Returns the next outstanding Exception, or null if there are no more exceptions outstanding. This may be called from the GUI thread (assuming that the delete is running in the background).The Exceptions are plain Exceptions, with an explanation and the problem DN in the message text. If the exception was caused by a DSAPIException, this is available using the getCause() method.
-
getEntryCount
public int getEntryCount()Return the number of entries deleted -
getErrorCount
public int getErrorCount()Return the number of errors noted to date.
-