public class DefaultDirContextValidator extends java.lang.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 DirContext
s.
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 |
---|---|
protected org.apache.commons.logging.Log |
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 |
---|---|
java.lang.String |
getBase() |
java.lang.String |
getFilter() |
javax.naming.directory.SearchControls |
getSearchControls() |
void |
setBase(java.lang.String base) |
void |
setFilter(java.lang.String filter) |
void |
setSearchControls(javax.naming.directory.SearchControls searchControls) |
boolean |
validateDirContext(DirContextType contextType,
javax.naming.directory.DirContext dirContext)
Validates the
DirContext . |
protected final org.apache.commons.logging.Log 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 SearchControls
public java.lang.String getBase()
public void setBase(java.lang.String base)
base
- the baseName to setpublic java.lang.String getFilter()
public void setFilter(java.lang.String filter)
filter
- the filter to setpublic javax.naming.directory.SearchControls getSearchControls()
public void setSearchControls(javax.naming.directory.SearchControls searchControls)
searchControls
- the searchControls to setpublic boolean validateDirContext(DirContextType contextType, javax.naming.directory.DirContext dirContext)
DirContextValidator
DirContext
. A valid DirContext
should be able
to answer queries and if applicable write to the directory.validateDirContext
in interface DirContextValidator
contextType
- The type of the DirContext
, refers to if ContextSource.getReadOnlyContext()
or ContextSource.getReadWriteContext()
was called to create the DirContext
dirContext
- The DirContext
to validate.true
if the DirContext
operated correctly during validation.DirContextValidator.validateDirContext(DirContextType, javax.naming.directory.DirContext)