Package org.ldaptive.control.util
Class PersistentSearchClient
java.lang.Object
org.ldaptive.control.util.PersistentSearchClient
Client that simplifies using the persistent search control.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether to return only changed entries.private final EnumSet<PersistentSearchChangeType>Change types.private final ConnectionFactoryConnection factory to get a connection from.private SearchOperationHandleSearch operation handle.protected final LoggerLogger for this class.Invoked when an entry is received.Invoked when an exception is received.Invoked when a result is received.private final booleanWhether to return an Entry Change Notification control. -
Constructor Summary
ConstructorsConstructorDescriptionPersistentSearchClient(ConnectionFactory cf, EnumSet<PersistentSearchChangeType> types, boolean co, boolean re) Creates a new persistent search client. -
Method Summary
Modifier and TypeMethodDescriptionvoidabandon()Invokes an abandon operation on the search handle.private RequestControl[]appendRequestControls(SearchRequest request) Creates a new array of request controls which includes the persistent search request control.send(SearchRequest request) Performs an async search operation with thePersistentSearchRequestControl.voidsetOnEntry(Consumer<LdapEntry> consumer) Sets the onEntry consumer.voidsetOnException(Consumer<Exception> consumer) Sets the onException consumer.voidsetOnResult(Consumer<Result> consumer) Sets the onResult consumer.
-
Field Details
-
logger
Logger for this class. -
factory
Connection factory to get a connection from. -
changeTypes
Change types. -
changesOnly
private final boolean changesOnlyWhether to return only changed entries. -
returnEcs
private final boolean returnEcsWhether to return an Entry Change Notification control. -
handle
Search operation handle. -
onEntry
Invoked when an entry is received. -
onResult
Invoked when a result is received. -
onException
Invoked when an exception is received.
-
-
Constructor Details
-
PersistentSearchClient
public PersistentSearchClient(ConnectionFactory cf, EnumSet<PersistentSearchChangeType> types, boolean co, boolean re) Creates a new persistent search client.- Parameters:
cf- to get a connection fromtypes- persistent search change typesco- whether only changed entries are returnedre- return an Entry Change Notification control
-
-
Method Details
-
setOnEntry
Sets the onEntry consumer.- Parameters:
consumer- to invoke when an entry is received
-
setOnResult
Sets the onResult consumer.- Parameters:
consumer- to invoke when a result is received
-
setOnException
Sets the onException consumer.- Parameters:
consumer- to invoke when a sync info message is received
-
send
Performs an async search operation with thePersistentSearchRequestControl. The supplied request is modified in the following way:AbstractRequestMessage.setControls(org.ldaptive.control.RequestControl...)is invoked withPersistentSearchRequestControl
The search request object should not be reused for any other search operations.
- Parameters:
request- search request to execute- Returns:
- search operation handle
- Throws:
LdapException- if the search fails
-
abandon
public void abandon()Invokes an abandon operation on the search handle. -
appendRequestControls
Creates a new array of request controls which includes the persistent search request control. Any other request controls are included.- Parameters:
request- to read controls from- Returns:
- search request controls
-