public class DefaultDirContextValidator extends Object implements DirContextValidator
DirContext validator that executes DirContext.search(String, String, SearchControls). The
name, filter and SearchControls are all configurable. There is no special handling for read only versus
read write DirContexts.
| Property | Description | Required | Default |
|---|---|---|---|
| base | The name parameter to the search method. | No | "" |
| filter | The filter parameter to the search method. | No | "objectclass=*" |
| searchControls |
The SearchControls parameter to the search method.
|
No |
SearchControls.setCountLimit(long) = 1SearchControls.setReturningAttributes(String[]) = new String[] { "objectclass" }SearchControls.setTimeLimit(int) = 500
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_FILTER |
protected org.slf4j.Logger |
logger
Logger for this class and sub-classes
|
| Constructor and Description |
|---|
DefaultDirContextValidator()
Create the default validator, creates
SearchControls with search scope OBJECT_SCOPE,
a countLimit of 1, returningAttributes of objectclass and timeLimit of 500. |
DefaultDirContextValidator(int searchScope)
Create a validator with all the defaults of the default constructor, but with the search scope set to the
referred value.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getBase() |
String |
getFilter() |
SearchControls |
getSearchControls() |
void |
setBase(String base) |
void |
setFilter(String filter) |
void |
setSearchControls(SearchControls searchControls) |
boolean |
validateDirContext(DirContextType contextType,
DirContext dirContext)
Validates the
DirContext. |
public static final String DEFAULT_FILTER
protected final org.slf4j.Logger logger
public DefaultDirContextValidator()
SearchControls with search scope OBJECT_SCOPE,
a countLimit of 1, returningAttributes of objectclass and timeLimit of 500.
The default base is an empty string and the default filter is objectclass=*public DefaultDirContextValidator(int searchScope)
searchScope - The searchScope to be set in the default SearchControlspublic String getBase()
public void setBase(String base)
base - the baseName to setpublic String getFilter()
public void setFilter(String filter)
filter - the filter to setpublic SearchControls getSearchControls()
public void setSearchControls(SearchControls searchControls)
searchControls - the searchControls to setpublic boolean validateDirContext(DirContextType contextType, DirContext dirContext)
DirContextValidatorDirContext. A valid DirContext should be able
to answer queries and if applicable write to the directory.validateDirContext in interface DirContextValidatorcontextType - The type of the DirContext, refers to if ContextSource.getReadOnlyContext() or ContextSource.getReadWriteContext() was called to create the DirContextdirContext - The DirContext to validate.true if the DirContext operated correctly during validation.DirContextValidator.validateDirContext(DirContextType, DirContext)