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.ObjectLdapSearchqueries an LDAP and returns the result. Each instance ofLdapSearchmaintains 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 LdapBeanFactorybeanFactoryLdap bean factory.protected org.apache.commons.logging.LogloggerLog for this class.protected LdapPool<Ldap>poolLdap object to use for searching.
-
Constructor Summary
Constructors Constructor Description LdapSearch(LdapPool<Ldap> pool)This creates a newLdapSearchwith the supplied pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Empties the underlying ldap pool, closing all connections.protected voidfinalize()Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.LdapBeanFactorygetLdapBeanFactory()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.voidsearch(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.voidsetLdapBeanFactory(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.NamingExceptionThis will perform an LDAP search with the supplied query and return attributes.- Parameters:
query-Stringto search forattrs-String[]to return- Returns:
Iteratorof 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.IOExceptionThis will perform an LDAP search with the supplied query and return attributes. The results will be written to the suppliedWriter.- Parameters:
query-Stringto search forattrs-String[]to returnwriter-Writerto 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.ThrowableCalled by the garbage collector on an object when garbage collection determines that there are no more references to the object.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- if an exception is thrown by this method
-
-