Package org.ldaptive.templates
Class SearchTemplatesExecutor
- java.lang.Object
-
- org.ldaptive.templates.SearchTemplatesExecutor
-
- Direct Known Subclasses:
AbstractServletSearchTemplatesExecutor
public class SearchTemplatesExecutor extends Object
Searches an LDAP using a defined set of search templates. For each term count some number of templates are defined and used for searching.
-
-
Field Summary
Fields Modifier and Type Field Description private PooledConnectionFactory[]connectionFactoriesConnection factory.protected LoggerloggerLogger for this class.private AggregatePooledSearchExecutorsearchExecutorSearch executor.private SearchTemplates[]searchTemplatesSearch templates.
-
Constructor Summary
Constructors Constructor Description SearchTemplatesExecutor()Default constructor.SearchTemplatesExecutor(AggregatePooledSearchExecutor executor, PooledConnectionFactory[] factories, SearchTemplates... templates)Creates a new templates search executor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes any resources associated with this object.PooledConnectionFactory[]getConnectionFactories()Returns the connection factories.AggregatePooledSearchExecutorgetSearchExecutor()Returns the search executor.SearchTemplates[]getSearchTemplates()Returns the search templates.protected SearchResultsearch(SearchFilter[] filters, String[] returnAttrs, Integer fromResult, Integer toResult)Performs an LDAP search with the supplied filters and aggregates all the search results together.SearchResultsearch(Query query)Applies the supplied query to a search templates and aggregates all results into a single search result.voidsetConnectionFactories(PooledConnectionFactory[] factories)Sets the connection factories.voidsetSearchExecutor(AggregatePooledSearchExecutor executor)Sets the search executor.voidsetSearchTemplates(SearchTemplates[] templates)Sets the search templates.StringtoString()
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
searchExecutor
private AggregatePooledSearchExecutor searchExecutor
Search executor.
-
connectionFactories
private PooledConnectionFactory[] connectionFactories
Connection factory.
-
searchTemplates
private SearchTemplates[] searchTemplates
Search templates.
-
-
Constructor Detail
-
SearchTemplatesExecutor
public SearchTemplatesExecutor()
Default constructor.
-
SearchTemplatesExecutor
public SearchTemplatesExecutor(AggregatePooledSearchExecutor executor, PooledConnectionFactory[] factories, SearchTemplates... templates)
Creates a new templates search executor.- Parameters:
executor- aggregate pooled search executorfactories- pooled connection factoriestemplates- search templates
-
-
Method Detail
-
getSearchExecutor
public AggregatePooledSearchExecutor getSearchExecutor()
Returns the search executor.- Returns:
- aggregate pooled search executor
-
setSearchExecutor
public void setSearchExecutor(AggregatePooledSearchExecutor executor)
Sets the search executor.- Parameters:
executor- aggregate pooled search executor
-
getConnectionFactories
public PooledConnectionFactory[] getConnectionFactories()
Returns the connection factories.- Returns:
- pooled connection factories
-
setConnectionFactories
public void setConnectionFactories(PooledConnectionFactory[] factories)
Sets the connection factories.- Parameters:
factories- pooled connection factory
-
getSearchTemplates
public SearchTemplates[] getSearchTemplates()
Returns the search templates.- Returns:
- search templates
-
setSearchTemplates
public void setSearchTemplates(SearchTemplates[] templates)
Sets the search templates.- Parameters:
templates- search templates
-
search
public SearchResult search(Query query) throws LdapException
Applies the supplied query to a search templates and aggregates all results into a single search result.- Parameters:
query- to execute- Returns:
- ldap result
- Throws:
LdapException- if the search fails
-
search
protected SearchResult search(SearchFilter[] filters, String[] returnAttrs, Integer fromResult, Integer toResult) throws LdapException
Performs an LDAP search with the supplied filters and aggregates all the search results together.- Parameters:
filters- to executereturnAttrs- attributes to return from the searchfromResult- index to return results fromtoResult- index to return results to- Returns:
- ldap result containing all results
- Throws:
LdapException- if the search fails
-
close
public void close()
Closes any resources associated with this object.
-
-