edu.vt.middleware.ldap
public class LdapSearch extends java.lang.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.
|
java.util.Iterator<javax.naming.directory.SearchResult> |
search(java.lang.String query,
java.lang.String[] attrs)
This will perform an LDAP search with the supplied query and return
attributes.
|
void |
search(java.lang.String query,
java.lang.String[] attrs,
java.io.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 java.util.Iterator<javax.naming.directory.SearchResult> search(java.lang.String query, java.lang.String[] attrs) throws javax.naming.NamingException
query
- String
to search forattrs
- String[]
to returnIterator
of search resultsjavax.naming.NamingException
- if an error occurs while searchingpublic void search(java.lang.String query, java.lang.String[] attrs, java.io.Writer writer) throws javax.naming.NamingException, java.io.IOException
Writer
.query
- String
to search forattrs
- String[]
to returnwriter
- Writer
to write tojavax.naming.NamingException
- if an error occurs while searchingjava.io.IOException
- if an error occurs while writing search resultspublic void close()
LdapPool.close()
.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- if an exception is thrown by this methodCopyright © 2014. All Rights Reserved.