public class LdapSearch extends Object
LdapSearch
queries an LDAP and returns the result. Each instance
of LdapSearch
maintains it's own pool of LDAP connections.Modifier and Type | Field and Description |
---|---|
protected LdapBeanFactory |
beanFactory
Ldap bean factory.
|
protected org.apache.commons.logging.Log |
logger
Log for this class.
|
protected LdapPool<Ldap> |
pool
Ldap object to use for searching.
|
Constructor and Description |
---|
LdapSearch(LdapPool<Ldap> pool)
This creates a new
LdapSearch with the supplied pool. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Empties the underlying ldap pool, closing all connections.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
LdapBeanFactory |
getLdapBeanFactory()
Returns the factory for creating ldap beans.
|
Iterator<SearchResult> |
search(String query,
String[] attrs)
This will perform an LDAP search with the supplied query and return
attributes.
|
void |
search(String query,
String[] attrs,
Writer writer)
This will perform an LDAP search with the supplied query and return
attributes.
|
void |
setLdapBeanFactory(LdapBeanFactory lbf)
Sets the factory for creating ldap beans.
|
protected final org.apache.commons.logging.Log logger
protected LdapBeanFactory beanFactory
public LdapBeanFactory getLdapBeanFactory()
LdapBeanFactory
public void setLdapBeanFactory(LdapBeanFactory lbf)
lbf
- LdapBeanFactory
public Iterator<SearchResult> search(String query, String[] attrs) throws NamingException
query
- String
to search forattrs
- String[]
to returnIterator
of search resultsNamingException
- if an error occurs while searchingpublic void search(String query, String[] attrs, Writer writer) throws NamingException, IOException
Writer
.query
- String
to search forattrs
- String[]
to returnwriter
- Writer
to write toNamingException
- if an error occurs while searchingIOException
- if an error occurs while writing search resultspublic void close()
LdapPool.close()
.Copyright © 2014. All rights reserved.