Class SchemaValidationPolicy
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumeration of the possible actions which can be performed when a schema validation failure is encountered. -
Method Summary
Modifier and TypeMethodDescriptionadaptSchemaForValidation
(Schema schema) Returns a strict view of the provided schema if this policy is configured to check attributes and object class, or a non-strict view of the schema if not.Returns the policy for verifying that the user attributes in an entry conform to its object classes.Specifies the policy for verifying that the user attributes in an entry conform to its object classes.Returns the policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions.Specifies the policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions.Returns the policy for validating entries against content rules defined in the schema.Specifies the policy for validating entries against content rules defined in the schema.Returns the policy for validating entries against structure rules defined in the schema.checkDitStructureRules
(SchemaValidationPolicy.Action policy, Function<Dn, Entry, LdapException> parentEntryResolver) Specifies the policy for validating entries against structure rules defined in the schema.Returns the parent entry resolver which should be used for retrieving the parent entry during DIT structure rule validation.Returns the policy for validating entries against name forms defined in the schema.Specifies the policy for validating entries against name forms defined in the schema.static SchemaValidationPolicy
copyOf
(SchemaValidationPolicy policy) Creates a copy of the provided schema validation policy.static SchemaValidationPolicy
Creates a new schema validation policy with default settings.static SchemaValidationPolicy
Creates a new schema validation policy which will not perform any schema validation.Returns the policy for verifying that entries have only a single structural object class.Specifies the policy for verifying that entries have only a single structural object class.
-
Method Details
-
copyOf
Creates a copy of the provided schema validation policy.- Parameters:
policy
- The policy to be copied.- Returns:
- The copy of the provided schema validation policy.
-
defaultPolicy
Creates a new schema validation policy with default settings. More specifically:- Entries not having a single structural object class will be rejected
- Entries having attributes which are not permitted by its object classes or DIT content rule (if present) will be rejected
- Entries not conforming to name forms will be rejected
- DIT structure rules will not be ignored
- Returns:
- The new schema validation policy.
-
ignoreAll
Creates a new schema validation policy which will not perform any schema validation.- Returns:
- The new schema validation policy.
-
checkAttributesAndObjectClasses
Returns the policy for verifying that the user attributes in an entry conform to its object classes. More specifically, an entry must contain all required user attributes, and must not contain any user attributes which are not declared as required or optional by its object classes.By default entries which have missing or additional user attributes will be rejected.
- Returns:
- The policy for verifying that the user attributes in an entry conform to its object classes.
-
checkAttributesAndObjectClasses
Specifies the policy for verifying that the user attributes in an entry conform to its object classes. More specifically, an entry must contain all required user attributes, and must not contain any user attributes which are not declared as required or optional by its object classes.By default entries which have missing or additional user attributes will be rejected.
- Parameters:
policy
- The policy for verifying that the user attributes in an entry conform to its object classes.- Returns:
- A reference to this
SchemaValidationPolicy
.
-
checkAttributeValues
Returns the policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions. This may include:- checking that there is at least one value
- checking that single-valued attributes contain only a single value
- checking that there are no duplicate values according to the attribute's default equality matching rule
- checking that attributes which require BER encoding specify the
;binary
attribute option - checking that the values are valid according to the attribute's syntax.
By default entries which have invalid attribute values will be rejected.
- Returns:
- The policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions.
-
checkAttributeValues
Specifies the policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions. This may include:- checking that there is at least one value
- checking that single-valued attributes contain only a single value
- checking that there are no duplicate values according to the attribute's default equality matching rule
- checking that attributes which require BER encoding specify the
;binary
attribute option - checking that the values are valid according to the attribute's syntax.
By default entries which have invalid attribute values will be rejected.
- Parameters:
policy
- The policy for verifying that the user attributes in an entry conform to their associated attribute type descriptions.- Returns:
- A reference to this
SchemaValidationPolicy
.
-
checkDitContentRules
Returns the policy for validating entries against content rules defined in the schema.By default content rules will be ignored during validation.
- Returns:
- The policy for validating entries against content rules defined in the schema.
-
checkDitContentRules
Specifies the policy for validating entries against content rules defined in the schema.By default content rules will be ignored during validation.
- Parameters:
policy
- The policy for validating entries against content rules defined in the schema.- Returns:
- A reference to this
SchemaValidationPolicy
.
-
checkDitStructureRules
Returns the policy for validating entries against structure rules defined in the schema.By default structure rules will be ignored during validation.
- Returns:
- The policy for validating entries against structure rules defined in the schema.
-
checkDitStructureRules
public SchemaValidationPolicy checkDitStructureRules(SchemaValidationPolicy.Action policy, Function<Dn, Entry, LdapException> parentEntryResolver) Specifies the policy for validating entries against structure rules defined in the schema.By default structure rules will be ignored during validation.
- Parameters:
policy
- The policy for validating entries against structure rules defined in the schema.parentEntryResolver
- The parent entry resolver function which should be used for retrieving the parent entry during DIT structure rule validation. The function's parameter is the name of the entry for which the parent must be resolved. The function will return the entry that is the parent of the provided entry name, if it can be validated and was resolved successfully, otherwise it will returnnull
if the parent entry is not to be validated, otherwise it will throwLdapException
if the parent entry should be validated but it could not be resolved.- Returns:
- A reference to this
SchemaValidationPolicy
. - Throws:
IllegalArgumentException
- Ifresolver
wasnull
andcheckDITStructureRules
is eitherWARN
orREJECT
.- See Also:
-
checkDitStructureRulesParentEntryResolver
Returns the parent entry resolver which should be used for retrieving the parent entry during DIT structure rule validation.By default no resolver is defined because structure rules will be ignored during validation.
- Returns:
- A function whose parameter is the name of the entry for which the parent must be resolved.
- See Also:
-
checkNameForms
Returns the policy for validating entries against name forms defined in the schema.By default name forms will be ignored during validation.
- Returns:
- The policy for validating entries against name forms defined in the schema.
-
checkNameForms
Specifies the policy for validating entries against name forms defined in the schema.By default name forms will be ignored during validation.
- Parameters:
policy
- The policy for validating entries against name forms defined in the schema.- Returns:
- A reference to this
SchemaValidationPolicy
.
-
requireSingleStructuralObjectClass
Returns the policy for verifying that entries have only a single structural object class.By default entries which do not have a structural object class or which have more than one structural object class will be rejected.
- Returns:
- The policy for checking that entries have one and only one structural object class.
-
requireSingleStructuralObjectClass
public SchemaValidationPolicy requireSingleStructuralObjectClass(SchemaValidationPolicy.Action policy) Specifies the policy for verifying that entries have only a single structural object class.By default entries which do not have a structural object class or which have more than one structural object class will be rejected.
- Parameters:
policy
- The policy for checking that entries have one and only one structural object class.- Returns:
- A reference to this
SchemaValidationPolicy
.
-
adaptSchemaForValidation
Returns a strict view of the provided schema if this policy is configured to check attributes and object class, or a non-strict view of the schema if not.- Parameters:
schema
- The schema to be adapted according to this policy.- Returns:
- A strict or non-strict view of
schema
depending oncheckAttributesAndObjectClasses()
.
-