APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.jndi.toolkit.dir

public Class SearchFilter

extends Object
implements AttrFilter
Class Inheritance
All Implemented Interfaces
com.sun.jndi.toolkit.dir.AttrFilter
Imports
javax.naming.*, javax.naming.directory.*, java.util.Enumeration, .HexFormat, .StringTokenizer, .Vector, .Locale

A class for parsing LDAP search filters (defined in RFC 1960, 2254)
Authors
Jon Ruiz, Rosanna Lee

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
SearchFilter.AtomicFilter

A class for dealing with atomic filters

pack-priv class
SearchFilter.CompoundFilter

A class for dealing with compound filters ("and" & "or" filters).

pack-priv class
SearchFilter.NotFilter

A class for dealing with NOT filters

pack-priv static interface

Field Summary

Modifier and TypeField and Description
protected static final char
pack-priv static final int
protected static final char
protected static final char
protected static final boolean
protected static final char
pack-priv static final int
protected static final char
protected static final char
pack-priv String
pack-priv static final int
protected static final char
pack-priv static final int
protected static final char
protected static final char
protected static final char
pack-priv int
private SearchFilter.StringFilter
protected static final char

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Attributes targetAttrs)

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

protected void
protected void
consumeChars(int i)

protected SearchFilter.StringFilter
public static int
findUnescaped(char ch, String val, int start)

Finds the first occurrence of ch in val starting from position start.

public static String
format(Attributes attrs)

Creates an LDAP filter as a conjunction of the attributes supplied.

public static String
format(String expr, Object[] args)

Formats the expression expr using arguments from the array args.

protected char
private static String
getEncodedStringRep(Object obj)

Returns the string representation of an object (such as an attr value).

protected void
protected char
relCharAt(int i)

protected int
relIndexOf(int ch)

protected String
relSubstring(int beginIndex, int endIndex)

public static Attributes
selectAttributes(Attributes originals, String[] attrIDs)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AND_TOKENback to summary
protected static final char AND_TOKEN
APPROX_MATCHback to summary
pack-priv static final int APPROX_MATCH
APPROX_TOKENback to summary
protected static final char APPROX_TOKEN
BEGIN_FILTER_TOKENback to summary
protected static final char BEGIN_FILTER_TOKEN
debugback to summary
protected static final boolean debug
END_FILTER_TOKENback to summary
protected static final char END_FILTER_TOKEN
EQUAL_MATCHback to summary
pack-priv static final int EQUAL_MATCH
EQUAL_TOKENback to summary
protected static final char EQUAL_TOKEN
EXTEND_TOKENback to summary
protected static final char EXTEND_TOKEN
filterback to summary
pack-priv String filter
GREATER_MATCHback to summary
pack-priv static final int GREATER_MATCH
GREATER_TOKENback to summary
protected static final char GREATER_TOKEN
LESS_MATCHback to summary
pack-priv static final int LESS_MATCH
LESS_TOKENback to summary
protected static final char LESS_TOKEN
NOT_TOKENback to summary
protected static final char NOT_TOKEN
OR_TOKENback to summary
protected static final char OR_TOKEN
posback to summary
pack-priv int pos
rootFilterback to summary
private SearchFilter.StringFilter rootFilter
WILDCARD_TOKENback to summary
protected static final char WILDCARD_TOKEN

Constructor Detail

SearchFilterback to summary
public SearchFilter(String filter) throws InvalidSearchFilterException

Method Detail

checkback to summary
public boolean check(Attributes targetAttrs) throws NamingException

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Doc from com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

consumeCharback to summary
protected void consumeChar()
consumeCharsback to summary
protected void consumeChars(int i)
createNextFilterback to summary
protected SearchFilter.StringFilter createNextFilter() throws InvalidSearchFilterException
findUnescapedback to summary
public static int findUnescaped(char ch, String val, int start)

Finds the first occurrence of ch in val starting from position start. It doesn't count if ch has been escaped by a backslash (\)

formatback to summary
public static String format(Attributes attrs) throws NamingException

Creates an LDAP filter as a conjunction of the attributes supplied.

formatback to summary
public static String format(String expr, Object[] args) throws NamingException

Formats the expression expr using arguments from the array args. {i} specifies the i'th element from the array args is to be substituted for the string "{i}". To escape '{' or '}' (or any other character), use '\'. Uses getEncodedStringRep() to do encoding.

getCurrentCharback to summary
protected char getCurrentChar()
getEncodedStringRepback to summary
private static String getEncodedStringRep(Object obj) throws NamingException

Returns the string representation of an object (such as an attr value). If obj is a byte array, encode each item as \xx, where xx is hex encoding of the byte value. Else, if obj is not a String, use its string representation (toString()). Special characters in obj (or its string representation) are then encoded appropriately according to RFC 2254. * \2a ( \28 ) \29 \ \5c NUL \00

normalizeFilterback to summary
protected void normalizeFilter()
relCharAtback to summary
protected char relCharAt(int i)
relIndexOfback to summary
protected int relIndexOf(int ch)
relSubstringback to summary
protected String relSubstring(int beginIndex, int endIndex)
selectAttributesback to summary
public static Attributes selectAttributes(Attributes originals, String[] attrIDs) throws NamingException
skipWhiteSpaceback to summary
private void skipWhiteSpace()
com.sun.jndi.toolkit.dir back to summary

pack-priv final Class SearchFilter.AtomicFilter

extends Object
implements StringFilter
Class Inheritance
All Implemented Interfaces
com.sun.jndi.toolkit.dir.SearchFilter.StringFilter, com.sun.jndi.toolkit.dir.AttrFilter

A class for dealing with atomic filters

Field Summary

Modifier and TypeField and Description
private String
private int
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Attributes targetAttrs)

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

public void
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attrIDback to summary
private String attrID
matchTypeback to summary
private int matchType
valueback to summary
private String value

Constructor Detail

AtomicFilterback to summary
pack-priv AtomicFilter()

Method Detail

checkback to summary
public boolean check(Attributes targetAttrs)

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Doc from com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

parseback to summary
public void parse() throws InvalidSearchFilterException

Implements com.sun.jndi.toolkit.dir.SearchFilter.StringFilter.parse.

substringMatchback to summary
private boolean substringMatch(String proto, String value)
com.sun.jndi.toolkit.dir back to summary

pack-priv final Class SearchFilter.CompoundFilter

extends Object
implements StringFilter
Class Inheritance
All Implemented Interfaces
com.sun.jndi.toolkit.dir.SearchFilter.StringFilter, com.sun.jndi.toolkit.dir.AttrFilter

A class for dealing with compound filters ("and" & "or" filters).

Field Summary

Modifier and TypeField and Description
private boolean
private Vector<SearchFilter.StringFilter>

Constructor Summary

AccessConstructor and Description
pack-priv
CompoundFilter(boolean polarity)

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Attributes targetAttrs)

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

polarityback to summary
private boolean polarity
subFiltersback to summary
private Vector<SearchFilter.StringFilter> subFilters

Constructor Detail

CompoundFilterback to summary
pack-priv CompoundFilter(boolean polarity)

Method Detail

checkback to summary
public boolean check(Attributes targetAttrs) throws NamingException

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Doc from com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

parseback to summary
public void parse() throws InvalidSearchFilterException

Implements com.sun.jndi.toolkit.dir.SearchFilter.StringFilter.parse.

com.sun.jndi.toolkit.dir back to summary

pack-priv final Class SearchFilter.NotFilter

extends Object
implements StringFilter
Class Inheritance
All Implemented Interfaces
com.sun.jndi.toolkit.dir.SearchFilter.StringFilter, com.sun.jndi.toolkit.dir.AttrFilter

A class for dealing with NOT filters

Field Summary

Modifier and TypeField and Description
private SearchFilter.StringFilter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Attributes targetAttrs)

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filterback to summary
private SearchFilter.StringFilter filter

Constructor Detail

NotFilterback to summary
pack-priv NotFilter()

Method Detail

checkback to summary
public boolean check(Attributes targetAttrs) throws NamingException

Implements com.sun.jndi.toolkit.dir.AttrFilter.check.

Doc from com.sun.jndi.toolkit.dir.AttrFilter.check.

Determines whether an attribute passes the filter.

parseback to summary
public void parse() throws InvalidSearchFilterException

Implements com.sun.jndi.toolkit.dir.SearchFilter.StringFilter.parse.

com.sun.jndi.toolkit.dir back to summary

pack-priv Interface SearchFilter.StringFilter

extends AttrFilter
Known Direct Implementers
com.sun.jndi.toolkit.dir.SearchFilter.CompoundFilter, com.sun.jndi.toolkit.dir.SearchFilter.NotFilter, com.sun.jndi.toolkit.dir.SearchFilter.AtomicFilter

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from com.sun.jndi.toolkit.dir.AttrFilter:
check

Method Detail

parseback to summary
public void parse() throws InvalidSearchFilterException