edu.vt.middleware.ldap.ldif.LdifSearch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vt-ldap Show documentation
Show all versions of vt-ldap Show documentation
Library for performing common LDAP operations
/*
$Id: LdifSearch.java 1330 2010-05-23 22:10:53Z dfisher $
Copyright (C) 2003-2010 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: [email protected]
Version: $Revision: 1330 $
Updated: $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
package edu.vt.middleware.ldap.ldif;
import java.io.IOException;
import java.io.Writer;
import javax.naming.NamingException;
import edu.vt.middleware.ldap.Ldap;
import edu.vt.middleware.ldap.LdapSearch;
import edu.vt.middleware.ldap.pool.LdapPool;
/**
* LdifSearch
queries an LDAP and returns the result as an LDIF.
* Each instance of LdifSearch
maintains it's own pool of LDAP
* connections.
*
* @author Middleware Services
* @version $Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
public class LdifSearch extends LdapSearch
{
/** Ldif object. */
private Ldif ldif = new Ldif();
/**
* This creates a new LdifSearch
with the supplied pool.
*
* @param pool LdapPool
*/
public LdifSearch(final LdapPool pool)
{
super(pool);
}
/**
* This will perform an LDAP search with the supplied query and return
* attributes. The results will be written to the supplied
* Writer
.
*
* @param query String
to search for
* @param attrs String[]
to return
* @param writer Writer
to write to
*
* @throws NamingException if an error occurs while searching
* @throws IOException if an error occurs while writing search results
*/
public void search(
final String query,
final String[] attrs,
final Writer writer)
throws NamingException, IOException
{
this.ldif.outputLdif(this.search(query, attrs), writer);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy