Class LDAPFilterDescriptor

java.lang.Object
netscape.ldap.util.LDAPFilterDescriptor

public class LDAPFilterDescriptor extends Object
Represents an LDAP filter configuration file read into memory.

Once you read in a filter file to create an object of this class, you can access the filter information through the methods that create LDAPFilterList and LDAPFilter objects. (You do not need to manually construct these objects yourself.)

This class (along with the other LDAP filter classes) provide functionality equivalent to the LDAP filter functions in the LDAP C API.

The format of the file/URL/buffer must be that as defined in the ldapfilter.conf(5) man page from the University of Michigan LDAP-3.3 distribution.

The LDAP filter classes provide a powerful way to configure LDAP clients by modifying a configuration file.

The following is a short example for how to use the LDAP filter classes.


 // ... Setup LDAPConnection up here ...
 

LDAPFilterDescriptor filterDescriptor;

// Create the LDAPFilterDescriptor given the file // "ldapfilter.conf". try { filterDescriptor = new LDAPFilterDescriptor ( "ldapfilter.conf" );

// Now retrieve the Filters in the form of an // LDAPFilterList LDAPFilterList filterList = new filterDescriptor.getFilters("match_tag", "string_user_typed");

// For each filter, do the search. Normally, you wouldn't // do the search if the first filter matched, but this is // just showing the enumeration type aspects of // LDAPFilterList LDAPFilter filter; while ( filterList.hasMoreElements() ) { filter = filterList.next(); LDAPResults results = LDAPConnection.search ( strBase, // base DN filter.getScope(), // scope filter.getFilter(), // completed filter null, // all attribs false ); // attrsOnly? }

// ...more processing here... } catch ( BadFilterException e ) { System.out.println ( e.toString() ); System.exit ( 0 ); } catch ( IOException e ) { // ...handle exception here... }

Version:
1.0
See Also:
  • Field Details

    • m_vFilterSet

      private Vector<LDAPIntFilterSet> m_vFilterSet
    • m_strLine

      private String m_strLine
    • m_nLine

      private int m_nLine
    • m_strPrefix

      private String m_strPrefix
    • m_strAffix

      private String m_strAffix
    • m_tmpFilterSet

      private LDAPIntFilterSet m_tmpFilterSet
    • m_strLastMatchPattern

      private String m_strLastMatchPattern
    • m_strLastDelimiter

      private String m_strLastDelimiter
    • DEFAULT_SCOPE

      private static final int DEFAULT_SCOPE
      The Default scope is used when a scope is not defined in the filter file. The scope is the only "optional" parameter in the file.
      See Also:
  • Constructor Details

    • LDAPFilterDescriptor

      public LDAPFilterDescriptor(String strFile) throws FileNotFoundException, BadFilterException
      Creates an LDAPFilterDescriptor object from an existing filter configuration file. This file has the format as defined in the ldapfilter.conf(5) man page.
      Throws:
      BadFilterException - One of the filters was not generated properly. Most likely this is due to an improperly formatted ldapfilter.conf file.
      FileNotFoundException
    • LDAPFilterDescriptor

      public LDAPFilterDescriptor(StringBuffer strBuffer) throws BadFilterException
      Creates an LDAPFilterDescriptor object from an existing StringBuffer. This file has the format as defined in the ldapfilter.conf(5) man page.
      Throws:
      BadFilterException - One of the filters was not generated properly. Most likely this is due to an improperly formatted ldapfilter.conf file.
    • LDAPFilterDescriptor

      public LDAPFilterDescriptor(URL url) throws IOException, BadFilterException
      Creates an LDAPFilterDescriptor object from a URL. This file has the format as defined in the ldapfilter.conf(5) man page.
      Throws:
      BadFilterException - One of the filters was not generated properly. Most likely this is due to an improperly formatted ldapfilter.conf file.
      IOException
  • Method Details