Package org.ldaptive.control.util
Class SyncReplClient
- java.lang.Object
-
- org.ldaptive.control.util.SyncReplClient
-
public class SyncReplClient extends java.lang.ObjectClient that simplifies using the sync repl control.- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.LoggerloggerLogger for this class.
-
Constructor Summary
Constructors Constructor Description SyncReplClient(ConnectionFactory cf, boolean persist)Creates a new sync repl client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtendedOperationHandlecancel()Sends a cancel operation on the underlying search operation.voidclose()Closes the connection factory.ConnectionFactorygetConnectionFactory()Returns the connection factory.booleanisComplete()Returns whether a search result has been received by this client.SearchOperationHandlesend(SearchRequest request)Invokessend(SearchRequest, CookieManager)with aDefaultCookieManager.SearchOperationHandlesend(SearchRequest request, CookieManager manager)Performs an async search operation with theSyncRequestControl.voidsetOnEntry(java.util.function.Consumer<LdapEntry> consumer)Sets the onEntry consumer.voidsetOnException(java.util.function.Consumer<java.lang.Exception> consumer)Sets the onException consumer.voidsetOnMessage(java.util.function.Consumer<SyncInfoMessage> consumer)Sets the onMessage consumer.voidsetOnResult(java.util.function.Consumer<Result> consumer)Sets the onResult consumer.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SyncReplClient
public SyncReplClient(ConnectionFactory cf, boolean persist)
Creates a new sync repl client.- Parameters:
cf- to get a connection frompersist- whether to refresh and persist or just refresh
-
-
Method Detail
-
getConnectionFactory
public ConnectionFactory getConnectionFactory()
Returns the connection factory.- Returns:
- connection factory
-
setOnEntry
public void setOnEntry(java.util.function.Consumer<LdapEntry> consumer)
Sets the onEntry consumer.- Parameters:
consumer- to invoke when an entry is received
-
setOnResult
public void setOnResult(java.util.function.Consumer<Result> consumer)
Sets the onResult consumer.- Parameters:
consumer- to invoke when a result is received
-
setOnMessage
public void setOnMessage(java.util.function.Consumer<SyncInfoMessage> consumer)
Sets the onMessage consumer.- Parameters:
consumer- to invoke when a sync info message is received
-
setOnException
public void setOnException(java.util.function.Consumer<java.lang.Exception> consumer)
Sets the onException consumer.- Parameters:
consumer- to invoke when a sync info message is received
-
send
public SearchOperationHandle send(SearchRequest request) throws LdapException
Invokessend(SearchRequest, CookieManager)with aDefaultCookieManager.- Parameters:
request- search request to execute- Returns:
- search operation handle
- Throws:
LdapException- if the search fails
-
send
public SearchOperationHandle send(SearchRequest request, CookieManager manager) throws LdapException
Performs an async search operation with theSyncRequestControl. The supplied request is modified in the following way:AbstractRequestMessage.setControls( org.ldaptive.control.RequestControl...)is invoked withSyncRequestControl
The search request object should not be reused for any other search operations.
- Parameters:
request- search request to executemanager- for reading and writing cookies- Returns:
- search operation handle
- Throws:
LdapException- if the search fails
-
isComplete
public boolean isComplete()
Returns whether a search result has been received by this client.- Returns:
- whether a search result has been received
-
cancel
public ExtendedOperationHandle cancel()
Sends a cancel operation on the underlying search operation. SeeDefaultOperationHandle.cancel().- Returns:
- cancel operation result
-
close
public void close()
Closes the connection factory.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-