|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unboundid.ldap.sdk.schema.EntryValidator
@ThreadSafety(level=MOSTLY_THREADSAFE) public final class EntryValidator
This class provides a mechanism for validating entries against a schema. It
provides the ability to customize the types of validation to perform, and can
collect information about the entries that fail validation to provide a
summary of the problems encountered.
The types of validation that may be performed for each entry include:
entryIsValid(com.unboundid.ldap.sdk.Entry, java.util.List)
is designed so that it can be invoked concurrently by multiple threads.
Note, however, that it is not recommended that the any of the other methods
in this class be used while any threads are running the entryIsValid
method because changing the configuration or attempting to retrieve retrieve
information may yield inaccurate or inconsistent results.
Constructor Summary | |
---|---|
EntryValidator(Schema schema)
Creates a new entry validator that will validate entries according to the provided schema. |
Method Summary | |
---|---|
boolean |
checkAttributeSyntax()
Indicates whether the entry validator should consider entries invalid if they contain attributes which violate the associated attribute syntax. |
boolean |
checkEntryMissingRDNValues()
Indicates whether the entry validator should consider entries invalid if they contain one or more attribute values in their RDN that are not present in the set of entry attributes. |
boolean |
checkMalformedDNs()
Indicates whether the entry validator should consider entries invalid if their DNs cannot be parsed. |
boolean |
checkMissingAttributes()
Indicates whether the entry validator should consider entries invalid if they are missing attributes which are required by the object classes or DIT content rule (if applicable) for the entry. |
boolean |
checkMissingSuperiorObjectClasses()
Indicates whether the entry validator should consider entries invalid if they are missing any superior classes for the included set of object classes. |
boolean |
checkNameForms()
Indicates whether the entry validator should consider entries invalid if the attributes contained in the RDN violate the constraints of the associated name form. |
boolean |
checkProhibitedAttributes()
Indicates whether the entry validator should consider entries invalid if they contain attributes which are not allowed by (or are prohibited by) the object classes and DIT content rule (if applicable) for the entry. |
boolean |
checkProhibitedObjectClasses()
Indicates whether the entry validator should consider entries invalid if they contain auxiliary object classes which are not allowed by the DIT content rule (if applicable) for the entry, or if they contain any abstract object classes which are not subclassed by any non-abstract classes included in the entry. |
boolean |
checkSingleValuedAttributes()
Indicates whether the entry validator should consider entries invalid if they they contain attributes with more than one value which are declared as single-valued in the schema. |
boolean |
checkStructuralObjectClasses()
Indicates whether the entry validator should consider entries invalid if they do not contain exactly one structural object class (i.e., either do not have any structural object class, or have more than one). |
boolean |
checkUndefinedAttributes()
Indicates whether the entry validator should consider entries invalid if they contain attributes which are not defined in the schema. |
boolean |
checkUndefinedObjectClasses()
Indicates whether the entry validator should consider entries invalid if they contain object classes which are not defined in the schema. |
boolean |
entryIsValid(Entry entry,
java.util.List<java.lang.String> invalidReasons)
Indicates whether the provided entry passes all of the enabled types of validation. |
java.util.Map<java.lang.String,java.lang.Long> |
getAttributesViolatingSyntax()
Retrieves the attributes with values violating their associated syntax that were encountered while processing entries, mapped from the name of the attribute to the number of malformed values found for that attribute. |
long |
getEntriesExamined()
Retrieves the total number of entries examined during processing. |
long |
getEntriesMissingRDNValues()
Retrieves the total number of entries examined that included an attribute value in the RDN that was not present in the entry attributes. |
long |
getEntriesMissingStructuralObjectClass()
Retrieves the total number of entries examined which did not contain any structural object class. |
long |
getEntriesWithMissingSuperiorObjectClasses()
Retrieves the total number of entries examined which were missing one or more superior object classes. |
long |
getEntriesWithMultipleStructuralObjectClasses()
Retrieves the total number of entries examined which contained more than one structural object class. |
long |
getEntriesWithoutAnyObjectClasses()
Retrieves the total number of entries examined which did not contain any object classes. |
java.util.Set<AttributeTypeDefinition> |
getIgnoreSyntaxViolationsAttributeTypes()
Retrieves the set of attribute types for which syntax violations should be ignored. |
long |
getInvalidEntries()
Retrieves the total number of invalid entries encountered during processing. |
java.util.List<java.lang.String> |
getInvalidEntrySummary(boolean detailedResults)
Retrieves a list of messages providing a summary of the invalid entries processed by this class. |
long |
getMalformedDNs()
Retrieves the total number of entries examined that had malformed DNs which could not be parsed. |
java.util.Map<java.lang.String,java.lang.Long> |
getMissingAttributes()
Retrieves the missing required encountered while processing entries, mapped from the name of the attribute to the number of entries in which that attribute was required but not found. |
long |
getNameFormViolations()
Retrieves the total number of entries examined which contained an RDN that violated the constraints of the associated name form. |
java.util.Map<java.lang.String,java.lang.Long> |
getProhibitedAttributes()
Retrieves the prohibited attributes encountered while processing entries, mapped from the name of the attribute to the number of entries in which that attribute was referenced. |
java.util.Map<java.lang.String,java.lang.Long> |
getProhibitedObjectClasses()
Retrieves the prohibited object classes encountered while processing entries, mapped from the name of the object class to the number of entries in which that object class was referenced. |
java.util.Map<java.lang.String,java.lang.Long> |
getSingleValueViolations()
Retrieves the attributes defined as single-valued that contained multiple values which were encountered while processing entries, mapped from the name of the attribute to the number of entries in which that attribute had multiple values. |
long |
getTotalAttributesViolatingSyntax()
Retrieves the total number of attribute values which violate their associated syntax that were encountered while examining entries. |
long |
getTotalMissingAttributes()
Retrieves the total number of missing required attributes encountered while examining entries. |
long |
getTotalProhibitedAttributes()
Retrieves the total number of prohibited attributes encountered while examining entries. |
long |
getTotalProhibitedObjectClasses()
Retrieves the total number of prohibited object classes encountered while examining entries. |
long |
getTotalSingleValueViolations()
Retrieves the total number of attributes defined as single-valued that contained multiple values which were encountered while processing entries. |
long |
getTotalUndefinedAttributes()
Retrieves the total number of undefined attribute types encountered while examining entries. |
long |
getTotalUndefinedObjectClasses()
Retrieves the total number of undefined object classes encountered while examining entries. |
java.util.Map<java.lang.String,java.lang.Long> |
getUndefinedAttributes()
Retrieves the undefined attribute types encountered while processing entries, mapped from the name of the undefined attribute to the number of entries in which that attribute type was referenced. |
java.util.Map<java.lang.String,java.lang.Long> |
getUndefinedObjectClasses()
Retrieves the undefined object classes encountered while processing entries, mapped from the name of the undefined object class to the number of entries in which that object class was referenced. |
void |
resetCounts()
Resets all counts maintained by this entry validator. |
void |
setCheckAttributeSyntax(boolean checkAttributeSyntax)
Specifies whether the entry validator should consider entries invalid if they contain attributes which violate the associated attribute syntax. |
void |
setCheckEntryMissingRDNValues(boolean checkEntryMissingRDNValues)
Specifies whether the entry validator should consider entries invalid if they contain one or more attribute values in their RDN that are not present in the set of entry attributes. |
void |
setCheckMalformedDNs(boolean checkMalformedDNs)
Specifies whether the entry validator should consider entries invalid if their DNs cannot be parsed. |
void |
setCheckMissingAttributes(boolean checkMissingAttributes)
Specifies whether the entry validator should consider entries invalid if they are missing attributes which are required by the object classes or DIT content rule (if applicable) for the entry. |
void |
setCheckMissingSuperiorObjectClasses(boolean checkMissingSuperiorObjectClasses)
Specifies whether the entry validator should consider entries invalid if they are missing any superior classes for the included set of object classes. |
void |
setCheckNameForms(boolean checkNameForms)
Specifies whether the entry validator should consider entries invalid if the attributes contained in the RDN violate the constraints of the associated name form. |
void |
setCheckProhibitedAttributes(boolean checkProhibitedAttributes)
Specifies whether the entry validator should consider entries invalid if they contain attributes which are not allowed by (or are prohibited by) the object classes and DIT content rule (if applicable) for the entry. |
void |
setCheckProhibitedObjectClasses(boolean checkProhibitedObjectClasses)
Specifies whether the entry validator should consider entries invalid if they contain auxiliary object classes which are not allowed by the DIT content rule (if applicable) for the entry, or if they contain any abstract object classes which are not subclassed by any non-abstract classes included in the entry. |
void |
setCheckSingleValuedAttributes(boolean checkSingleValuedAttributes)
Specifies whether the entry validator should consider entries invalid if they contain attributes with more than one value which are declared as single-valued in the schema. |
void |
setCheckStructuralObjectClasses(boolean checkStructuralObjectClasses)
Specifies whether the entry validator should consider entries invalid if they do not contain exactly one structural object class (i.e., either do not have any structural object class, or have more than one). |
void |
setCheckUndefinedAttributes(boolean checkUndefinedAttributes)
Specifies whether the entry validator should consider entries invalid if they contain attributes which are not defined in the schema. |
void |
setCheckUndefinedObjectClasses(boolean checkUndefinedObjectClasses)
Specifies whether the entry validator should consider entries invalid if they contain object classes which are not defined in the schema. |
void |
setIgnoreSyntaxViolationAttributeTypes(AttributeTypeDefinition... attributeTypes)
Specifies the set of attribute types for which syntax violations should be ignored. |
void |
setIgnoreSyntaxViolationAttributeTypes(java.util.Collection<java.lang.String> attributeTypes)
Specifies the names or OIDs of the attribute types for which syntax violations should be ignored. |
void |
setIgnoreSyntaxViolationAttributeTypes(java.lang.String... attributeTypes)
Specifies the names or OIDs of the attribute types for which syntax violations should be ignored. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntryValidator(Schema schema)
schema
- The schema against which entries will be validated.Method Detail |
---|
public boolean checkMissingAttributes()
true
if entries that are missing attributes required by
its object classes or DIT content rule should be considered
invalid, or false
if not.public void setCheckMissingAttributes(boolean checkMissingAttributes)
checkMissingAttributes
- Indicates whether the entry validator
should consider entries invalid if they are
missing required attributes.public boolean checkMissingSuperiorObjectClasses()
true
if entries that are missing superior classes should
be considered invalid, or false
if not.public void setCheckMissingSuperiorObjectClasses(boolean checkMissingSuperiorObjectClasses)
checkMissingSuperiorObjectClasses
- Indicates whether the entry
validator should consider
entries invalid if they are
missing any superior classes for
the included set of object
classes.public boolean checkMalformedDNs()
true
if entries with malformed DNs should be considered
invalid, or false
if not.public void setCheckMalformedDNs(boolean checkMalformedDNs)
checkMalformedDNs
- Specifies whether entries with malformed DNs
should be considered invalid.public boolean checkEntryMissingRDNValues()
true
if entries missing one or more attribute values
included in their RDNs should be considered invalid, or
false
if not.public void setCheckEntryMissingRDNValues(boolean checkEntryMissingRDNValues)
checkEntryMissingRDNValues
- Indicates whether the entry validator
should consider entries invalid if they
contain one or more attribute values in
their RDN that are not present in the
set of entry attributes.public boolean checkNameForms()
true
if entries with RDNs that do not conform to the
associated name form should be considered invalid, or
false
if not.public void setCheckNameForms(boolean checkNameForms)
checkNameForms
- Indicates whether the entry validator should
consider entries invalid if their RDNs violate name
form constraints.public boolean checkProhibitedAttributes()
true
if entries should be considered invalid if they
contain attributes which are not allowed, or false
if not.public void setCheckProhibitedAttributes(boolean checkProhibitedAttributes)
checkProhibitedAttributes
- Indicates whether entries should be
considered invalid if they contain
attributes which are not allowed.public boolean checkProhibitedObjectClasses()
true
if entries should be considered invalid if they
contain prohibited object classes, or false
if not.public void setCheckProhibitedObjectClasses(boolean checkProhibitedObjectClasses)
checkProhibitedObjectClasses
- Indicates whether entries should be
considered invalid if they contain
prohibited object classes.public boolean checkSingleValuedAttributes()
true
if entries should be considered invalid if they
contain single-valued attributes with more than one value, or
false
if not.public void setCheckSingleValuedAttributes(boolean checkSingleValuedAttributes)
checkSingleValuedAttributes
- Indicates whether entries should be
considered invalid if they contain
single-valued attributes with more
than one value.public boolean checkStructuralObjectClasses()
true
if entries should be considered invalid if they do
not have exactly one structural object class, or false
if
not.public void setCheckStructuralObjectClasses(boolean checkStructuralObjectClasses)
checkStructuralObjectClasses
- Indicates whether entries should be
considered invalid if they do not
have exactly one structural object
class.public boolean checkAttributeSyntax()
true
if entries should be considered invalid if they
contain attribute values which violate the associated attribute
syntax, or false
if not.public void setCheckAttributeSyntax(boolean checkAttributeSyntax)
checkAttributeSyntax
- Indicates whether entries should be
considered invalid if they violate the
associated attribute syntax.public java.util.Set<AttributeTypeDefinition> getIgnoreSyntaxViolationsAttributeTypes()
checkAttributeSyntax()
returns true
, then
any attribute syntax violations will be flagged for all attributes except
those attributes in this set. If checkAttributeSyntax()
returns
false
, then all syntax violations will be ignored.
public void setIgnoreSyntaxViolationAttributeTypes(AttributeTypeDefinition... attributeTypes)
checkAttributeSyntax()
returns true
.
attributeTypes
- The definitions for the attribute types for which
to ignore syntax violations. It may be
null
or empty if no violations should be
ignored.public void setIgnoreSyntaxViolationAttributeTypes(java.lang.String... attributeTypes)
checkAttributeSyntax()
returns true
.
attributeTypes
- The names or OIDs of the attribute types for which
to ignore syntax violations. It may be
null
or empty if no violations should be
ignored.public void setIgnoreSyntaxViolationAttributeTypes(java.util.Collection<java.lang.String> attributeTypes)
checkAttributeSyntax()
returns true
.
attributeTypes
- The names or OIDs of the attribute types for which
to ignore syntax violations. It may be
null
or empty if no violations should be
ignored. Any attribute types not defined in the
schema will be ignored.public boolean checkUndefinedAttributes()
true
if entries should be considered invalid if they
contain attributes which are not defined in the schema, or
false
if not.public void setCheckUndefinedAttributes(boolean checkUndefinedAttributes)
checkUndefinedAttributes
- Indicates whether entries should be
considered invalid if they contain
attributes which are not defined in the
schema, or false
if not.public boolean checkUndefinedObjectClasses()
true
if entries should be considered invalid if they
contain object classes which are not defined in the schema, or
false
if not.public void setCheckUndefinedObjectClasses(boolean checkUndefinedObjectClasses)
checkUndefinedObjectClasses
- Indicates whether entries should be
considered invalid if they contain
object classes which are not defined
in the schema.public boolean entryIsValid(Entry entry, java.util.List<java.lang.String> invalidReasons)
entry
- The entry to be examined. It must not be
null
.invalidReasons
- A list to which messages may be added which provide
information about why the entry is invalid. It may
be null
if this information is not needed.
true
if the entry conforms to all of the enabled forms of
validation, or false
if the entry fails at least one of
the tests.public void resetCounts()
public long getEntriesExamined()
public long getInvalidEntries()
public long getMalformedDNs()
public long getEntriesMissingRDNValues()
public long getEntriesWithoutAnyObjectClasses()
public long getEntriesMissingStructuralObjectClass()
public long getEntriesWithMultipleStructuralObjectClasses()
public long getEntriesWithMissingSuperiorObjectClasses()
public long getNameFormViolations()
public long getTotalUndefinedObjectClasses()
public java.util.Map<java.lang.String,java.lang.Long> getUndefinedObjectClasses()
public long getTotalUndefinedAttributes()
public java.util.Map<java.lang.String,java.lang.Long> getUndefinedAttributes()
public long getTotalProhibitedObjectClasses()
public java.util.Map<java.lang.String,java.lang.Long> getProhibitedObjectClasses()
public long getTotalProhibitedAttributes()
public java.util.Map<java.lang.String,java.lang.Long> getProhibitedAttributes()
public long getTotalMissingAttributes()
public java.util.Map<java.lang.String,java.lang.Long> getMissingAttributes()
public long getTotalAttributesViolatingSyntax()
public java.util.Map<java.lang.String,java.lang.Long> getAttributesViolatingSyntax()
public long getTotalSingleValueViolations()
public java.util.Map<java.lang.String,java.lang.Long> getSingleValueViolations()
public java.util.List<java.lang.String> getInvalidEntrySummary(boolean detailedResults)
detailedResults
- Indicates whether to include detailed information
about the attributes and object classes
responsible for the violations.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |