public final class PersistentSearch extends Object
Operations are responsible for managing the persistent searches that they are currently handling.
Typically, a search operation will first decode the persistent search control and construct a new PersistentSearch
.
Once the initial search result set has been returned and no errors encountered, the search operation should register
a cancellation callback which will be invoked when the persistent search is cancelled. This is achieved using
registerCancellationCallback(CancellationCallback)
. The callback should make sure that any resources
associated with the PersistentSearch
are released. This may included removing the PersistentSearch
from a list, or abandoning a persistent search operation that has been sent to a remote server.
Finally, the PersistentSearch
should be enabled using enable()
. This method will register the PersistentSearch
with the client connection and notify the underlying search operation that no result should be sent
to the client.
Persistent searches should be shutdown with cancel(boolean)
when the operation fails, or its backend is
shutdown, etc.
Modifier and Type | Class and Description |
---|---|
static interface |
PersistentSearch.CancellationCallback
A cancellation callback which can be used in order to register for resource cleanup when a persistent search is
cancelled.
|
Constructor and Description |
---|
PersistentSearch(SearchOperation searchOperation,
Set<PersistentSearchChangeType> changeTypes,
boolean changesOnly,
boolean returnECs)
Creates a new persistent search object with the provided information.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Server side abort of this persistent search operation.
|
void |
cancel()
Cancels this persistent search operation.
|
void |
enable()
Enable this persistent search.
|
int |
getMessageID()
Gets the message ID associated with this persistent search.
|
SearchOperation |
getSearchOperation()
Get the search operation associated with this persistent search.
|
boolean |
isCancelled()
Returns whether this persistent search is cancelled.
|
boolean |
isChangesOnly()
Returns whether only entries updated after the beginning of this persistent search should be returned.
|
void |
processAdd(Entry entry)
Notifies the persistent searches that an entry has been added.
|
void |
processDelete(Entry entry)
Notifies the persistent searches that an entry has been deleted.
|
void |
processModify(Entry entry,
Entry oldEntry)
Notifies persistent searches that an entry has been modified.
|
void |
processModifyDN(Entry entry,
Dn oldDN)
Notifies the persistent searches that an entry has been renamed.
|
void |
registerCancellationCallback(PersistentSearch.CancellationCallback callback)
Registers a cancellation callback with this persistent search.
|
String |
toString()
Retrieves a string representation of this persistent search.
|
public PersistentSearch(SearchOperation searchOperation, Set<PersistentSearchChangeType> changeTypes, boolean changesOnly, boolean returnECs)
searchOperation
- The search operation for this persistent search.changeTypes
- The change types for which changes should be examined.changesOnly
- whether to only return entries that have been updated since the beginning of the searchreturnECs
- Indicates whether to include entry change notification controls in search result entries sent to the
client.public void enable()
public void cancel()
public void abort()
cancel()
,
(invalidate persistent search, associated searches cancelled) and it sends a result code to the client to warn of
the server error.public boolean isCancelled()
true
if this persistent search is cancelled,false
otherwisepublic int getMessageID()
public SearchOperation getSearchOperation()
public boolean isChangesOnly()
public void processAdd(Entry entry)
entry
- The entry that was added.public void processDelete(Entry entry)
entry
- The entry that was deleted.public void processModify(Entry entry, Entry oldEntry)
entry
- The entry after it was modified.oldEntry
- The entry before it was modified.public void processModifyDN(Entry entry, Dn oldDN)
entry
- The entry after it was modified.oldDN
- The DN of the entry before it was renamed.public void registerCancellationCallback(PersistentSearch.CancellationCallback callback)
callback
- The cancellation callback.Copyright 2010-2022 ForgeRock AS.