Package edu.vt.middleware.ldap
Class LdapSearch
- java.lang.Object
-
- edu.vt.middleware.ldap.LdapSearch
-
- Direct Known Subclasses:
DsmlSearch
,LdifSearch
public class LdapSearch extends java.lang.Object
LdapSearch
queries an LDAP and returns the result. Each instance ofLdapSearch
maintains it's own pool of LDAP connections.- Version:
- $Revision: 1330 $ $Date: 2010-05-24 00:10:53 +0200 (Mon, 24 May 2010) $
- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description LdapSearch(LdapPool<Ldap> pool)
This creates a newLdapSearch
with the supplied pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
logger
protected final org.apache.commons.logging.Log logger
Log for this class.
-
beanFactory
protected LdapBeanFactory beanFactory
Ldap bean factory.
-
-
Method Detail
-
getLdapBeanFactory
public LdapBeanFactory getLdapBeanFactory()
Returns the factory for creating ldap beans.- Returns:
LdapBeanFactory
-
setLdapBeanFactory
public void setLdapBeanFactory(LdapBeanFactory lbf)
Sets the factory for creating ldap beans.- Parameters:
lbf
-LdapBeanFactory
-
search
public java.util.Iterator<javax.naming.directory.SearchResult> search(java.lang.String query, java.lang.String[] attrs) throws javax.naming.NamingException
This will perform an LDAP search with the supplied query and return attributes.- Parameters:
query
-String
to search forattrs
-String[]
to return- Returns:
Iterator
of search results- Throws:
javax.naming.NamingException
- if an error occurs while searching
-
search
public void search(java.lang.String query, java.lang.String[] attrs, java.io.Writer writer) throws javax.naming.NamingException, java.io.IOException
This will perform an LDAP search with the supplied query and return attributes. The results will be written to the suppliedWriter
.- Parameters:
query
-String
to search forattrs
-String[]
to returnwriter
-Writer
to write to- Throws:
javax.naming.NamingException
- if an error occurs while searchingjava.io.IOException
- if an error occurs while writing search results
-
close
public void close()
Empties the underlying ldap pool, closing all connections. SeeLdapPool.close()
.
-
finalize
protected void finalize() throws java.lang.Throwable
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
- if an exception is thrown by this method
-
-