Package org.ldaptive
Class SearchOperation
- java.lang.Object
-
- org.ldaptive.AbstractOperation<SearchRequest,SearchResult>
-
- org.ldaptive.SearchOperation
-
- All Implemented Interfaces:
Operation<SearchRequest,SearchResult>
public class SearchOperation extends AbstractOperation<SearchRequest,SearchResult>
Executes an ldap search operation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ldaptive.AbstractOperation
AbstractOperation.ReopenOperationExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private Cache<SearchRequest>
cache
Cache to use when performing searches.-
Fields inherited from class org.ldaptive.AbstractOperation
logger
-
-
Constructor Summary
Constructors Constructor Description SearchOperation(Connection conn)
Creates a new search operation.SearchOperation(Connection conn, Cache<SearchRequest> c)
Creates a new search operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Response<SearchResult>
executeSearch(SearchRequest request)
Performs the ldap search.Cache<SearchRequest>
getCache()
Returns the cache to check when performing search operations.protected Response<SearchResult>
invoke(SearchRequest request)
Call the provider specific implementation of this ldap operation.protected SearchResult
readResult(SearchRequest request, SearchIterator si)
Invokes the provider search operation and iterates over the results.void
setCache(Cache<SearchRequest> c)
Sets the cache.-
Methods inherited from class org.ldaptive.AbstractOperation
execute, executeHandlers, getConnection, getOperationExceptionHandler, getOperationResponseHandlers, setOperationExceptionHandler, setOperationResponseHandlers, toString
-
-
-
-
Field Detail
-
cache
private Cache<SearchRequest> cache
Cache to use when performing searches.
-
-
Constructor Detail
-
SearchOperation
public SearchOperation(Connection conn)
Creates a new search operation.- Parameters:
conn
- connection
-
SearchOperation
public SearchOperation(Connection conn, Cache<SearchRequest> c)
Creates a new search operation.- Parameters:
conn
- connectionc
- cache
-
-
Method Detail
-
getCache
public Cache<SearchRequest> getCache()
Returns the cache to check when performing search operations. When a cache is provided it will be populated as new searches are performed and used when a search request hits the cache.- Returns:
- cache
-
setCache
public void setCache(Cache<SearchRequest> c)
Sets the cache.- Parameters:
c
- cache to set
-
invoke
protected Response<SearchResult> invoke(SearchRequest request) throws LdapException
Description copied from class:AbstractOperation
Call the provider specific implementation of this ldap operation.- Specified by:
invoke
in classAbstractOperation<SearchRequest,SearchResult>
- Parameters:
request
- ldap request- Returns:
- ldap response
- Throws:
LdapException
- if the invocation fails
-
executeSearch
protected Response<SearchResult> executeSearch(SearchRequest request) throws LdapException
Performs the ldap search.- Parameters:
request
- to invoke search with- Returns:
- ldap response
- Throws:
LdapException
- if an error occurs
-
readResult
protected SearchResult readResult(SearchRequest request, SearchIterator si) throws LdapException
Invokes the provider search operation and iterates over the results. Invokes handlers as necessary for each result type.- Parameters:
request
- used to create the search iteratorsi
- search iterator- Returns:
- search result
- Throws:
LdapException
- if an error occurs
-
-