Class PersistentSearchClient

java.lang.Object
org.ldaptive.control.util.PersistentSearchClient

public class PersistentSearchClient extends Object
Client that simplifies using the persistent search control.
  • Field Details

    • logger

      protected final Logger logger
      Logger for this class.
    • factory

      private final ConnectionFactory factory
      Connection factory to get a connection from.
    • changeTypes

      private final EnumSet<PersistentSearchChangeType> changeTypes
      Change types.
    • changesOnly

      private final boolean changesOnly
      Whether to return only changed entries.
    • returnEcs

      private final boolean returnEcs
      Whether to return an Entry Change Notification control.
    • handle

      private SearchOperationHandle handle
      Search operation handle.
    • onEntry

      private Consumer<LdapEntry> onEntry
      Invoked when an entry is received.
    • onResult

      private Consumer<Result> onResult
      Invoked when a result is received.
    • onException

      private Consumer<Exception> 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 from
      types - persistent search change types
      co - whether only changed entries are returned
      re - return an Entry Change Notification control
  • Method Details

    • setOnEntry

      public void setOnEntry(Consumer<LdapEntry> consumer)
      Sets the onEntry consumer.
      Parameters:
      consumer - to invoke when an entry is received
    • setOnResult

      public void setOnResult(Consumer<Result> consumer)
      Sets the onResult consumer.
      Parameters:
      consumer - to invoke when a result is received
    • setOnException

      public void setOnException(Consumer<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
      Performs an async search operation with the PersistentSearchRequestControl. The supplied request is modified in the following way:

      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

      private RequestControl[] appendRequestControls(SearchRequest request)
      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