public class SchemaInterceptor extends BaseInterceptor
Interceptor that manages and enforces schemas.| Modifier and Type | Class and Description |
|---|---|
private class |
SchemaInterceptor.TopFilter
Filters objectClass attribute to inject top when not present.
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> |
allMay
A map used to store all the objectClasses may attributes
|
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> |
allMust
A map used to store all the objectClasses must
|
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> |
allowed
A map used to store all the objectClasses allowed attributes (may + must)
|
private java.util.List<EntryFilter> |
filters |
private static boolean |
IS_DEBUG
Speedup for logs
|
private static org.slf4j.Logger |
LOG
The LoggerFactory used by this Interceptor
|
private PartitionNexus |
nexus
the root nexus to all database partitions
|
private org.apache.directory.api.ldap.model.name.Dn |
schemaBaseDn
the base Dn (normalized) of the schema partition
|
private org.apache.directory.api.ldap.model.name.Dn |
schemaModificationAttributesDn
The normalized name for the schema modification attributes
|
private SchemaSubentryManager |
schemaSubEntryManager
The schema manager
|
private org.apache.directory.api.ldap.model.name.Dn |
subschemaSubentryDn
The SubschemaSubentry Dn
|
private java.lang.String |
subschemaSubentryDnNorm
A normalized form for the SubschemaSubentry Dn
|
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass>> |
superiors
A map used to store all the objectClasses superiors
|
private SchemaInterceptor.TopFilter |
topFilter |
directoryService, dnFactory, PWD_POLICY_STATE_ATTRIBUTE_TYPES, schemaManager| Constructor and Description |
|---|
SchemaInterceptor()
Creates a new instance of a SchemaInterceptor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AddOperationContext addContext)
Filters
Partition#add( AddOperationContext ) call. |
private void |
alterObjectClasses(org.apache.directory.api.ldap.model.entry.Attribute objectClassAttr)
Given the objectClasses for an entry, this method adds missing ancestors
in the hierarchy except for top which it removes.
|
private void |
assertAllAttributesAllowed(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.Set<java.lang.String> allowed)
Checks to see if an attribute is required by as determined from an entry's
set of objectClass attribute values.
|
private void |
assertAttributeIsModifyable(ModifyOperationContext modifyContext,
org.apache.directory.api.ldap.model.schema.AttributeType attributeType) |
private void |
assertHumanReadable(org.apache.directory.api.ldap.model.entry.Entry entry)
Check that all the attribute's values which are Human Readable can be transformed
to valid String if they are stored as byte[], and that non Human Readable attributes
stored as String can be transformed to byte[]
|
private void |
assertNumberOfAttributeValuesValid(org.apache.directory.api.ldap.model.entry.Attribute attribute)
Checks to see numbers of values of attributes conforms to the schema
|
private void |
assertNumberOfAttributeValuesValid(org.apache.directory.api.ldap.model.entry.Entry entry)
Checks to see number of values of an attribute conforms to the schema
|
private void |
assertObjectClasses(org.apache.directory.api.ldap.model.name.Dn dn,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> ocs)
Checck that OC does not conflict :
- we can't have more than one STRUCTURAL OC unless they are in the same
inheritance tree
- we must have at least one STRUCTURAL OC
|
private void |
assertRdn(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry) |
private void |
assertRequiredAttributesPresent(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.Set<java.lang.String> must)
Checks to see the presence of all required attributes within an entry.
|
private void |
assertSyntaxes(org.apache.directory.api.ldap.model.entry.Entry entry)
Check the entry attributes syntax, using the syntaxCheckers
|
private void |
check(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry)
Check that all the attributes exist in the schema for this entry.
|
private void |
checkFilter(org.apache.directory.api.ldap.model.filter.ExprNode filter)
Check that the filter values are compatible with the AttributeType.
|
private boolean |
checkHumanReadable(org.apache.directory.api.ldap.model.entry.Attribute attribute)
Check a String attribute to see if there is some byte[] value in it.
|
private void |
checkModifyEntry(ModifyOperationContext modifyContext)
Modify an entry, applying the given modifications, and check if it's OK
|
private boolean |
checkNotHumanReadable(org.apache.directory.api.ldap.model.entry.Attribute attribute)
Check a binary attribute to see if there is some String value in it.
|
private void |
checkOcSuperior(org.apache.directory.api.ldap.model.entry.Entry entry) |
boolean |
compare(CompareOperationContext compareContext)
Filters
DefaultPartitionNexus#compare( CompareOperationContext ) call. |
private void |
computeMayAttributes(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.Set<java.lang.String> atSeen)
Compute the MAY attributes for an objectClass.
|
private void |
computeMustAttributes(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.Set<java.lang.String> atSeen)
Compute the MUST attributes for an objectClass.
|
private void |
computeOCSuperiors(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> superiors,
java.util.Set<java.lang.String> ocSeen)
Recursively compute all the superiors of an object class.
|
private void |
computeSuperior(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass)
Compute the superiors and MUST/MAY attributes for a specific
ObjectClass
|
private void |
computeSuperiors()
Compute all ObjectClasses superiors, MAY and MUST attributes.
|
private org.apache.directory.api.ldap.model.entry.Value<?> |
convert(org.apache.directory.api.ldap.model.schema.AttributeType attributeType,
org.apache.directory.api.ldap.model.entry.Value<?> value) |
private org.apache.directory.api.ldap.model.entry.Attribute |
createNewAttribute(org.apache.directory.api.ldap.model.entry.Attribute attribute)
Create a new attribute using the given values
|
private java.util.Set<java.lang.String> |
getAllAllowed(org.apache.directory.api.ldap.model.entry.Attribute objectClasses,
java.util.Set<java.lang.String> must) |
private java.util.Set<java.lang.String> |
getAllMust(org.apache.directory.api.ldap.model.entry.Attribute objectClasses) |
private boolean |
getObjectClasses(org.apache.directory.api.ldap.model.entry.Attribute objectClasses,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> result) |
private java.lang.String |
getSchemaName(org.apache.directory.api.ldap.model.name.Dn dn) |
private void |
getSuperiors(org.apache.directory.api.ldap.model.schema.ObjectClass oc,
java.util.Set<java.lang.String> ocSeen,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> result) |
void |
init(DirectoryService directoryService)
Initialize the Schema Service
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(LookupOperationContext lookupContext)
Filters
Partition#lookup( LookupOperationContext ) call. |
void |
modify(ModifyOperationContext modifyContext)
Filters
Partition#modify( ModifyOperationContext ) call. |
void |
rename(RenameOperationContext renameContext)
Filters
Partition#rename( RenameOperationContext ) call. |
EntryFilteringCursor |
search(SearchOperationContext searchContext)
Filters
Partition#search( SearchOperationContext ) call. |
bind, delete, destroy, getName, getNextInterceptor, getPrincipal, getRootDse, hasEntry, move, moveAndRename, next, next, next, next, next, next, next, next, next, next, next, next, next, unbindprivate static final org.slf4j.Logger LOG
private static final boolean IS_DEBUG
private PartitionNexus nexus
private SchemaInterceptor.TopFilter topFilter
private java.util.List<EntryFilter> filters
private java.lang.String subschemaSubentryDnNorm
private org.apache.directory.api.ldap.model.name.Dn subschemaSubentryDn
private org.apache.directory.api.ldap.model.name.Dn schemaModificationAttributesDn
private SchemaSubentryManager schemaSubEntryManager
private org.apache.directory.api.ldap.model.name.Dn schemaBaseDn
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass>> superiors
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> allMay
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> allMust
private java.util.Map<java.lang.String,java.util.List<org.apache.directory.api.ldap.model.schema.AttributeType>> allowed
public SchemaInterceptor()
public void init(DirectoryService directoryService) throws org.apache.directory.api.ldap.model.exception.LdapException
init in interface Interceptorinit in class BaseInterceptordirectoryService - the directory service corejava.lang.Exception - if there are problems during initializationorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void computeMustAttributes(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.Set<java.lang.String> atSeen)
throws org.apache.directory.api.ldap.model.exception.LdapException
atSeen - ???objectClass - the object class to gather MUST attributes forjava.lang.Exception - if there are problems resolving schema entititesorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void computeMayAttributes(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.Set<java.lang.String> atSeen)
throws org.apache.directory.api.ldap.model.exception.LdapException
atSeen - ???objectClass - the object class to get all the MAY attributes forjava.lang.Exception - with problems accessing registriesorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void computeOCSuperiors(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> superiors,
java.util.Set<java.lang.String> ocSeen)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void computeSuperior(org.apache.directory.api.ldap.model.schema.ObjectClass objectClass)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void computeSuperiors()
throws org.apache.directory.api.ldap.model.exception.LdapException
java.lang.Exceptionorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate org.apache.directory.api.ldap.model.entry.Value<?> convert(org.apache.directory.api.ldap.model.schema.AttributeType attributeType,
org.apache.directory.api.ldap.model.entry.Value<?> value)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void checkFilter(org.apache.directory.api.ldap.model.filter.ExprNode filter)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void getSuperiors(org.apache.directory.api.ldap.model.schema.ObjectClass oc,
java.util.Set<java.lang.String> ocSeen,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> result)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean getObjectClasses(org.apache.directory.api.ldap.model.entry.Attribute objectClasses,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> result)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.Set<java.lang.String> getAllMust(org.apache.directory.api.ldap.model.entry.Attribute objectClasses)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.Set<java.lang.String> getAllAllowed(org.apache.directory.api.ldap.model.entry.Attribute objectClasses,
java.util.Set<java.lang.String> must)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void alterObjectClasses(org.apache.directory.api.ldap.model.entry.Attribute objectClassAttr)
throws org.apache.directory.api.ldap.model.exception.LdapException
objectClassAttr - the objectClass attribute to modifyjava.lang.Exception - if there are problemsorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate org.apache.directory.api.ldap.model.entry.Attribute createNewAttribute(org.apache.directory.api.ldap.model.entry.Attribute attribute)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void checkModifyEntry(ModifyOperationContext modifyContext) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertAttributeIsModifyable(ModifyOperationContext modifyContext, org.apache.directory.api.ldap.model.schema.AttributeType attributeType) throws org.apache.directory.api.ldap.model.exception.LdapNoPermissionException
org.apache.directory.api.ldap.model.exception.LdapNoPermissionExceptionprivate void check(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void checkOcSuperior(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic void add(AddOperationContext addContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#add( AddOperationContext ) call.add in interface Interceptoradd in class BaseInterceptoraddContext - The AddOperationContext instanceorg.apache.directory.api.ldap.model.exception.LdapException - If we had some error while processing the Add operationpublic boolean compare(CompareOperationContext compareContext) throws org.apache.directory.api.ldap.model.exception.LdapException
DefaultPartitionNexus#compare( CompareOperationContext ) call.compare in interface Interceptorcompare in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.entry.Entry lookup(LookupOperationContext lookupContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#lookup( LookupOperationContext ) call.lookup in interface Interceptorlookup in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void modify(ModifyOperationContext modifyContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#modify( ModifyOperationContext ) call.modify in interface Interceptormodify in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void rename(RenameOperationContext renameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#rename( RenameOperationContext ) call.rename in interface Interceptorrename in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic EntryFilteringCursor search(SearchOperationContext searchContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#search( SearchOperationContext ) call.search in interface Interceptorsearch in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.lang.String getSchemaName(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertAllAttributesAllowed(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.Set<java.lang.String> allowed)
throws org.apache.directory.api.ldap.model.exception.LdapException
java.lang.Exception - if the attribute is not recognizedorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertNumberOfAttributeValuesValid(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException
org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueExceptionprivate void assertNumberOfAttributeValuesValid(org.apache.directory.api.ldap.model.entry.Attribute attribute)
throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException
org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueExceptionprivate void assertRequiredAttributesPresent(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.Set<java.lang.String> must)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertObjectClasses(org.apache.directory.api.ldap.model.name.Dn dn,
java.util.List<org.apache.directory.api.ldap.model.schema.ObjectClass> ocs)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertSyntaxes(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertRdn(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean checkHumanReadable(org.apache.directory.api.ldap.model.entry.Attribute attribute)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean checkNotHumanReadable(org.apache.directory.api.ldap.model.entry.Attribute attribute)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void assertHumanReadable(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException