@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class SubtreeDeleter extends java.lang.Object
setUseSetSubtreeAccessibilityOperationIfAvailable(boolean)
method is
called with a value of true
, then this extended operation will be
used if the server root DSE advertises support for both this operation
and the LDAP "Who Am I?" extended operation.
setUsePermitUnindexedSearchControlIfAvailable(boolean)
method is called
with a value of true
, then this control will be used if the
server root DSE advertises support for it.
Constructor and Description |
---|
SubtreeDeleter()
Creates a new instance of this subtree deleter with the default settings.
|
Modifier and Type | Method and Description |
---|---|
SubtreeDeleterResult |
delete(LDAPInterface connection,
DN baseDN)
Attempts to delete the specified subtree using the current settings.
|
SubtreeDeleterResult |
delete(LDAPInterface connection,
java.lang.String baseDN)
Attempts to delete the specified subtree using the current settings.
|
boolean |
deleteBaseEntry()
Indicates whether the base entry itself should be deleted along with all of
its subordinates.
|
java.util.List<Control> |
getAdditionalDeleteControls()
Retrieves an unmodifiable list of additional controls that should be
included in delete requests.
|
java.util.List<Control> |
getAdditionalSearchControls()
Retrieves an unmodifiable list of additional controls that should be
included in search requests used to identify entries to delete.
|
FixedRateBarrier |
getDeleteRateLimiter()
Retrieves the fixed-rate barrier that may be used to impose a rate limit on
delete operations, if defined.
|
int |
getSearchRequestSizeLimit()
Retrieves the size limit that should be used in each search request to
specify the maximum number of entries to return in response to that
request.
|
int |
getSimplePagedResultsPageSize()
Retrieves the maximum number of entries that should be returned in each
page of results when using the simple paged results control.
|
void |
setAdditionalDeleteControls(Control... additionalDeleteControls)
Specifies a list of additional controls that should be included in delete
requests.
|
void |
setAdditionalDeleteControls(java.util.List<Control> additionalDeleteControls)
Specifies a list of additional controls that should be included in delete
requests.
|
void |
setAdditionalSearchControls(Control... additionalSearchControls)
Specifies a list of additional controls that should be included in search
requests used to identify entries to delete.
|
void |
setAdditionalSearchControls(java.util.List<Control> additionalSearchControls)
Specifies a list of additional controls that should be included in search
requests used to identify entries to delete.
|
void |
setDeleteBaseEntry(boolean deleteBaseEntry)
Specifies whether the base entry itself should be deleted along with all of
its subordinates.
|
void |
setDeleteRateLimiter(FixedRateBarrier deleteRateLimiter)
Provides a fixed-rate barrier that may be used to impose a rate limit on
delete operations.
|
void |
setSearchRequestSizeLimit(int searchRequestSizeLimit)
Specifies the size limit that should be used in each search request to
specify the maximum number of entries to return in response to that
request.
|
void |
setSimplePagedResultsPageSize(int simplePagedResultsPageSize)
Specifies the maximum number of entries that should be returned in each
page of results when using the simple paged results control.
|
void |
setUseHardDeleteControlIfAvailable(boolean useHardDeleteControlIfAvailable)
Specifies whether to include the
HardDeleteRequestControl in
delete requests if the server root DSE advertises support for it. |
void |
setUseManageDSAITControlIfAvailable(boolean useManageDSAITControlIfAvailable)
Specifies whether to include the
ManageDsaITRequestControl in
search and delete requests if the server root DSE advertises support for
it. |
void |
setUsePermitUnindexedSearchControlIfAvailable(boolean usePermitUnindexedSearchControlIfAvailable)
Specifies whether to include the
PermitUnindexedSearchRequestControl in search request used to
identify the entries to be deleted if the server root DSE advertises
support for it. |
void |
setUseReturnConflictEntriesRequestControlIfAvailable(boolean useReturnConflictEntriesRequestControlIfAvailable)
Specifies whether to use the
ReturnConflictEntriesRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. |
void |
setUseSetSubtreeAccessibilityOperationIfAvailable(boolean useSetSubtreeAccessibilityOperationIfAvailable)
Specifies whether to use the
SetSubtreeAccessibilityExtendedRequest
to make the target subtree hidden before starting to search for entries to
delete if the server root DSE advertises support for both that extended
request and the "Who Am I?" extended request. |
void |
setUseSimplePagedResultsControlIfAvailable(boolean useSimplePagedResultsControlIfAvailable)
Specifies whether to use the
SimplePagedResultsControl when
searching for entries to delete if the server advertises support for it. |
void |
setUseSoftDeletedEntryAccessControlIfAvailable(boolean useSoftDeletedEntryAccessControlIfAvailable)
Specifies whether to use the
SoftDeletedEntryAccessRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. |
void |
setUseSubentriesControlIfAvailable(boolean useSubentriesControlIfAvailable)
Specifies whether to use the
DraftLDUPSubentriesRequestControl when
searching for entries to delete if the server root DSE advertises support
for it. |
java.lang.String |
toString()
Retrieves a string representation of this subtree deleter.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this subtree deleter to the provided
buffer.
|
boolean |
useHardDeleteControlIfAvailable()
Indicates whether to include the
HardDeleteRequestControl in
delete requests if the server root DSE advertises support for it. |
boolean |
useManageDSAITControlIfAvailable()
Indicates whether to include the
ManageDsaITRequestControl in
search and delete requests if the server root DSE advertises support for
it. |
boolean |
usePermitUnindexedSearchControlIfAvailable()
Indicates whether to include the
PermitUnindexedSearchRequestControl in search requests used to
identify the entries to be deleted if the server root DSE advertises
support for it. |
boolean |
useReturnConflictEntriesRequestControlIfAvailable()
Indicates whether to use the
ReturnConflictEntriesRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. |
boolean |
useSetSubtreeAccessibilityOperationIfAvailable()
Indicates whether to use the
SetSubtreeAccessibilityExtendedRequest
to make the target subtree hidden before starting to search for entries to
delete if the server root DSE advertises support for both that extended
request and the "Who Am I?" extended request. |
boolean |
useSimplePagedResultsControlIfAvailable()
Indicates whether to use the
SimplePagedResultsControl when
searching for entries to delete if the server advertises support for it. |
boolean |
useSoftDeletedEntryAccessControlIfAvailable()
Indicates whether to use the
SoftDeletedEntryAccessRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. |
boolean |
useSubentriesControlIfAvailable()
Indicates whether to use the
DraftLDUPSubentriesRequestControl when
searching for entries to delete if the server root DSE advertises support
for it. |
public SubtreeDeleter()
public boolean deleteBaseEntry()
true
by default.true
if the base entry should be deleted in addition to
its subordinates, or false
if the base entry should not
be deleted but all of its subordinates should be.public void setDeleteBaseEntry(boolean deleteBaseEntry)
deleteBaseEntry
- true
to indicate that the base entry should be deleted
in addition to its subordinates, or false
if only the
subordinates of the base entry should be removed.public boolean useSetSubtreeAccessibilityOperationIfAvailable()
SetSubtreeAccessibilityExtendedRequest
to make the target subtree hidden before starting to search for entries to
delete if the server root DSE advertises support for both that extended
request and the "Who Am I?" extended request. In servers that support it,
this extended operation can make the target subtree hidden and read-only to
clients other than those authenticated as the user that issued the set
subtree accessibility request.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports both the set subtree
accessibility extended operation and the "Who Am I?" extended operation.true
if the set subtree accessibility extended operation
should be used to make the target subtree hidden and read-only
before attempting to search for entries to delete if the server
root DSE advertises support for it, or false
if the
operation should not be used.public void setUseSetSubtreeAccessibilityOperationIfAvailable(boolean useSetSubtreeAccessibilityOperationIfAvailable)
SetSubtreeAccessibilityExtendedRequest
to make the target subtree hidden before starting to search for entries to
delete if the server root DSE advertises support for both that extended
request and the "Who Am I?" extended request. In servers that support it,
this extended operation can make the target subtree hidden and read-only to
clients other than those authenticated as the user that issued the set
subtree accessibility request.useSetSubtreeAccessibilityOperationIfAvailable
- true
to indicate that the set subtree accessibility
extended operation should be used to make the target subtree
hidden and read-only before starting to search for entries
to delete, or false
if not. This value will be
ignored if the server root DSE does not advertise support for
both the set subtree accessibility extended operation and the
"Who Am I?" extended operation.public boolean useSimplePagedResultsControlIfAvailable()
SimplePagedResultsControl
when
searching for entries to delete if the server advertises support for it.
Using this control can help avoid problems from running into the search
size limit, and can also prevent the server from trying to return entries
faster than the client can consume them.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the simple paged
results control.true
if the simple paged results control should be used
when searching for entries to delete if the server root DSE
advertises support for it, or false
if the control should
not be used.public void setUseSimplePagedResultsControlIfAvailable(boolean useSimplePagedResultsControlIfAvailable)
SimplePagedResultsControl
when
searching for entries to delete if the server advertises support for it.
Using this control can help avoid problems from running into the search
size limit, and can also prevent the server from trying to return entries
faster than the client can consume them.useSimplePagedResultsControlIfAvailable
- true
to indicate that the simple paged results control
should be used when searching for entries to delete, or
false
if not. This value will be ignored if the
server root DSE does not advertise support for the simple
paged results control.public int getSimplePagedResultsPageSize()
useSimplePagedResultsControlIfAvailable()
returns true
and the server root DSE indicates that it supports the
simple paged results control.
100
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the simple paged
results control.public void setSimplePagedResultsPageSize(int simplePagedResultsPageSize)
useSimplePagedResultsControlIfAvailable()
returns true
and the server root DSE indicates that it supports the
simple paged results control.simplePagedResultsPageSize
- The maximum number of entries that should be returned in each
page of results when using the simple paged results control.
The value must be greater than or equal to one.public boolean useManageDSAITControlIfAvailable()
ManageDsaITRequestControl
in
search and delete requests if the server root DSE advertises support for
it. The manage DSA IT request control tells the server that it should
return referral entries as regular entries rather than returning them as
search result references when processing a search operation, or returning a
referral result when attempting a delete. If any referrals are
encountered during processing and this control is not used, then it may
not be possible to completely delete the entire subtree.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the manage DSA IT
request control.true
if the manage DSA IT request control should be
included in search and delete requests if the server root DSE
advertises support for it, or false
if not.public void setUseManageDSAITControlIfAvailable(boolean useManageDSAITControlIfAvailable)
ManageDsaITRequestControl
in
search and delete requests if the server root DSE advertises support for
it. The manage DSA IT request control tells the server that it should
return referral entries as regular entries rather than returning them as
search result references when processing a search operation, or returning a
referral result when attempting a delete. If any referrals are
encountered during processing and this control is not used, then it may
not be possible to completely delete the entire subtree.useManageDSAITControlIfAvailable
- true
to indicate that the manage DSA IT request
control should be included in search and delete requests,
or false
if not. This value will be ignored if the
server root DSE does not advertise support for the manage DSA
IT request control.public boolean usePermitUnindexedSearchControlIfAvailable()
PermitUnindexedSearchRequestControl
in search requests used to
identify the entries to be deleted if the server root DSE advertises
support for it. The permit unindexed search request control may allow
appropriately authorized clients to explicitly indicate that the server
should process an unindexed search that would normally be rejected.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the permit unindexed
search request control.true
if search requests should include the permit
unindexed search request control if the server root DSE advertises
support for it, or false
if not.public void setUsePermitUnindexedSearchControlIfAvailable(boolean usePermitUnindexedSearchControlIfAvailable)
PermitUnindexedSearchRequestControl
in search request used to
identify the entries to be deleted if the server root DSE advertises
support for it. The permit unindexed search request control may allow
appropriately authorized clients to explicitly indicate that the server
should process an unindexed search that would normally be rejected.usePermitUnindexedSearchControlIfAvailable
- true
to indicate that the permit unindexed search
request control should be included in search requests, or
false
if not. This value will be ignored if the
server root DSE does not advertise support for the permit
unindexed search request control.public boolean useSubentriesControlIfAvailable()
DraftLDUPSubentriesRequestControl
when
searching for entries to delete if the server root DSE advertises support
for it. The subentries request control allows LDAP subentries to be
included in search results. These entries are normally excluded from
search results.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the subentries
request control.true
if the subentries request control should be used
to retrieve LDAP subentries if the server root DSE advertises
support for it, or false
if not.public void setUseSubentriesControlIfAvailable(boolean useSubentriesControlIfAvailable)
DraftLDUPSubentriesRequestControl
when
searching for entries to delete if the server root DSE advertises support
for it. The subentries request control allows LDAP subentries to be
included in search results. These entries are normally excluded from
search results.useSubentriesControlIfAvailable
- [@code true} to indicate that the subentries request control
should be used to retrieve LDAP subentries, or false
if not. This value will be ignored if the server root DSE
does not advertise support for the subentries request
control.public boolean useReturnConflictEntriesRequestControlIfAvailable()
ReturnConflictEntriesRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. The return conflict entries request control allows
replication conflict entries to be included in search results. These
entries are normally excluded from search results.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the return
conflict entries request control.true
if the return conflict entries request control
should be used to retrieve replication conflict entries if the
server root DSE advertises support for it, or false
if
not.public void setUseReturnConflictEntriesRequestControlIfAvailable(boolean useReturnConflictEntriesRequestControlIfAvailable)
ReturnConflictEntriesRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. The return conflict entries request control allows
replication conflict entries to be included in search results. These
entries are normally excluded from search results.useReturnConflictEntriesRequestControlIfAvailable
- true
to indicate that the return conflict entries
request control should be used to retrieve replication
conflict entries, or false
if not. This value will be
ignored if the server root DSE does not advertise support for
the return conflict entries request control.public boolean useSoftDeletedEntryAccessControlIfAvailable()
SoftDeletedEntryAccessRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. The soft-deleted entry access request control allows
soft-deleted entries to be included in search results. These entries are
normally excluded from search results.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the soft-deleted
entry access request control.true
if the soft-deleted entry access request control
should be used to retrieve soft-deleted entries if the server
root DSE advertises support for it, or false
if not.public void setUseSoftDeletedEntryAccessControlIfAvailable(boolean useSoftDeletedEntryAccessControlIfAvailable)
SoftDeletedEntryAccessRequestControl
when searching for entries to delete if the server root DSE advertises
support for it. The soft-deleted entry access request control allows
soft-deleted entries to be included in search results. These entries are
normally excluded from search results.useSoftDeletedEntryAccessControlIfAvailable
- true
to indicate that the soft-deleted entry access
request control should be used to retrieve soft-deleted
entries, or false
if not. This value will be ignored
if the server root DSE does not advertise support for the
soft-deleted entry access request control.public boolean useHardDeleteControlIfAvailable()
HardDeleteRequestControl
in
delete requests if the server root DSE advertises support for it. The
hard delete request control indicates that the server should treat a delete
operation as a hard delete even if it would have normally been processed as
a soft delete because it matches the criteria in a configured soft delete
policy.
true
by default. Its value will be ignored if
the server root DSE does not indicate that it supports the hard delete
request control.true
if the hard delete request control should be included
in delete requests if the server root DSE advertises support for
it, or false
if not.public void setUseHardDeleteControlIfAvailable(boolean useHardDeleteControlIfAvailable)
HardDeleteRequestControl
in
delete requests if the server root DSE advertises support for it. The
hard delete request control indicates that the server should treat a delete
operation as a hard delete even if it would have normally been processed as
a soft delete because it matches the criteria in a configured soft delete
policy.useHardDeleteControlIfAvailable
- true
to indicate that the hard delete request control
should be included in delete requests, or false
if
not. This value will be ignored if the server root DSE does
not advertise support for the hard delete request control.@NotNull public java.util.List<Control> getAdditionalSearchControls()
public void setAdditionalSearchControls(@NotNull Control... additionalSearchControls)
additionalSearchControls
- A list of additional controls that should be included in
search requests used to identify entries to delete. This must
not be null
but may be empty.public void setAdditionalSearchControls(@NotNull java.util.List<Control> additionalSearchControls)
additionalSearchControls
- A list of additional controls that should be included in
search requests used to identify entries to delete. This must
not be null
but may be empty.@NotNull public java.util.List<Control> getAdditionalDeleteControls()
public void setAdditionalDeleteControls(@NotNull Control... additionalDeleteControls)
additionalDeleteControls
- A list of additional controls that should be included in
delete requests. This must not be null
but may be
empty.public void setAdditionalDeleteControls(@NotNull java.util.List<Control> additionalDeleteControls)
additionalDeleteControls
- A list of additional controls that should be included in
delete requests. This must not be null
but may be
empty.public int getSearchRequestSizeLimit()
ResultCode.SIZE_LIMIT_EXCEEDED
.
public void setSearchRequestSizeLimit(int searchRequestSizeLimit)
ResultCode.SIZE_LIMIT_EXCEEDED
.
A value that is less than or equal to zero indicates that the client does
not want to impose any limit on the number of entries that may be returned
in response to any single search operation (although the server may still
impose a limit).searchRequestSizeLimit
- The size limit that should be used in each search request to
specify the maximum number of entries to return in response
to that request. A value that is less than or equal to zero
indicates that the client does not want to impose any size
limit.@Nullable public FixedRateBarrier getDeleteRateLimiter()
null
by default, to indicate that no delete
rate limit will be imposed.null
if no rate limit should be
imposed.public void setDeleteRateLimiter(@Nullable FixedRateBarrier deleteRateLimiter)
deleteRateLimiter
- A fixed-rate barrier that may be used to impose a rate limit
on delete operations. It may be null
if no delete
rate limit should be imposed.@NotNull public SubtreeDeleterResult delete(@NotNull LDAPInterface connection, @NotNull java.lang.String baseDN) throws LDAPException
connection
- The LDAPInterface
instance to use to communicate with
the directory server. While this may be an individual
LDAPConnection
, it may be better as a connection
pool with automatic retry enabled so that it's more likely to
succeed in the event that a connection becomes invalid or an
operation experiences a transient failure. It must not be
null
.baseDN
- The base DN for the subtree to delete. It must not be
null
.LDAPException
- If the provided base DN cannot be parsed as a valid
DN.@NotNull public SubtreeDeleterResult delete(@NotNull LDAPInterface connection, @NotNull DN baseDN)
connection
- The LDAPInterface
instance to use to communicate with
the directory server. While this may be an individual
LDAPConnection
, it may be better as a connection
pool with automatic retry enabled so that it's more likely to
succeed in the event that a connection becomes invalid or an
operation experiences a transient failure. It must not be
null
.baseDN
- The base DN for the subtree to delete. It must not be
null
.@NotNull public java.lang.String toString()
toString
in class java.lang.Object