public class SubentryInterceptor extends BaseInterceptor
| Modifier and Type | Class and Description |
|---|---|
private class |
SubentryInterceptor.HideEntriesFilter
SearchResultFilter used to filter out normal entries but shows subentries based on
objectClass values.
|
private class |
SubentryInterceptor.HideSubentriesFilter
SearchResultFilter used to filter out subentries based on objectClass values.
|
private static class |
SubentryInterceptor.OperationEnum
An enum used for the entries update
|
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOG
The logger for this class
|
private PartitionNexus |
nexus
A reference to the nexus for direct backend operations
|
private org.apache.directory.api.ldap.model.subtree.SubtreeSpecificationParser |
ssParser
The SubTree specification parser instance
|
private static java.lang.String |
SUBENTRY_CONTROL
the subentry control OID
|
private org.apache.directory.api.ldap.model.entry.Value<java.lang.String> |
subentryOC |
directoryService, dnFactory, PWD_POLICY_STATE_ATTRIBUTE_TYPES, schemaManager| Constructor and Description |
|---|
SubentryInterceptor()
Creates a new instance of SubentryInterceptor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AddOperationContext addContext)
Filters
Partition#add( AddOperationContext ) call. |
private void |
checkAdministrativeRole(OperationContext opContext,
org.apache.directory.api.ldap.model.name.Dn apDn)
Get the administrativePoint role
|
void |
delete(DeleteOperationContext deleteContext)
Filters
Partition#delete( DeleteOperationContext ) call. |
private java.util.List<org.apache.directory.api.ldap.model.entry.Modification> |
getModsOnEntryModification(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry oldEntry,
org.apache.directory.api.ldap.model.entry.Entry newEntry)
Get the list of modification to apply to all the entries
|
private java.util.List<org.apache.directory.api.ldap.model.entry.Modification> |
getModsOnEntryRdnChange(org.apache.directory.api.ldap.model.name.Dn oldName,
org.apache.directory.api.ldap.model.name.Dn newName,
org.apache.directory.api.ldap.model.entry.Entry entry) |
private void |
getOperationalModForReplace(boolean hasRole,
org.apache.directory.api.ldap.model.schema.AttributeType attributeType,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> modifications)
Update the list of modifications with a modification associated with a specific
role, if it's requested.
|
private java.util.List<org.apache.directory.api.ldap.model.entry.Modification> |
getOperationalModsForAdd(org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> operationalAttributes)
Calculates the subentry operational attributes to add or replace from
a candidate entry selected by a subtree specification.
|
private java.util.List<org.apache.directory.api.ldap.model.entry.Modification> |
getOperationalModsForRemove(org.apache.directory.api.ldap.model.name.Dn subentryDn,
org.apache.directory.api.ldap.model.entry.Entry candidate)
Calculates the subentry operational attributes to remove from a candidate
entry selected by a subtreeSpecification.
|
private java.util.List<org.apache.directory.api.ldap.model.entry.Modification> |
getOperationalModsForReplace(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
org.apache.directory.api.ldap.model.subtree.Subentry subentry,
org.apache.directory.api.ldap.model.entry.Entry entry)
Get the list of modifications to be applied on an entry to inject the operational attributes
associated with the administrative roles.
|
private java.util.Set<org.apache.directory.api.ldap.model.subtree.AdministrativeRole> |
getSubentryAdminRoles(org.apache.directory.api.ldap.model.entry.Entry subentry)
Return the list of AdministrativeRole for a subentry
|
private java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> |
getSubentryOperationalAttributes(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.subtree.Subentry subentry)
Gets the subschema operational attributes to be added to or removed from
an entry selected by a subentry's subtreeSpecification.
|
private java.util.Set<org.apache.directory.api.ldap.model.subtree.AdministrativeRole> |
getSubentryTypes(org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> mods) |
private boolean |
hasAdministrativeDescendant(OperationContext opContext,
org.apache.directory.api.ldap.model.name.Dn name)
Checks to see if an entry being renamed has a descendant that is an
administrative point.
|
void |
init(DirectoryService directoryService)
Initialize the Subentry Interceptor
|
private boolean |
isNamingContext(org.apache.directory.api.ldap.model.name.Dn dn)
Checks if the given Dn is a namingContext
|
private boolean |
isSubentryVisible(OperationContext opContext)
Checks to see if subentries for the search and list operations should be
made visible based on the availability of the search request control
|
void |
modify(ModifyOperationContext modifyContext)
Filters
Partition#modify( ModifyOperationContext ) call. |
void |
move(MoveOperationContext moveContext)
The Move operation for a Subentry will deal with different cases :
1) we move a normal entry
2) we move a subentry
3) we move an administrationPoint
|
void |
moveAndRename(MoveAndRenameOperationContext moveAndRenameContext)
Filters
Partition#moveAndRename( MoveAndRenameOperationContext) call. |
void |
rename(RenameOperationContext renameContext)
Filters
Partition#rename( RenameOperationContext ) call. |
EntryFilteringCursor |
search(SearchOperationContext searchContext)
Filters
Partition#search( SearchOperationContext ) call. |
private void |
setOperationalAttribute(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Dn subentryDn,
org.apache.directory.api.ldap.model.schema.AttributeType opAttr)
Update the Operational Attribute with the reference to the subentry
|
private void |
setSubtreeSpecification(org.apache.directory.api.ldap.model.subtree.Subentry subentry,
org.apache.directory.api.ldap.model.entry.Entry entry)
Get the SubtreeSpecification, parse it and stores it into the subentry
|
private void |
updateEntries(SubentryInterceptor.OperationEnum operation,
CoreSession session,
org.apache.directory.api.ldap.model.name.Dn subentryDn,
org.apache.directory.api.ldap.model.name.Dn apDn,
org.apache.directory.api.ldap.model.subtree.SubtreeSpecification ss,
org.apache.directory.api.ldap.model.name.Dn baseDn,
java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> operationalAttributes)
Update all the entries under an AP adding the
|
private static final org.slf4j.Logger LOG
private static final java.lang.String SUBENTRY_CONTROL
private org.apache.directory.api.ldap.model.entry.Value<java.lang.String> subentryOC
private org.apache.directory.api.ldap.model.subtree.SubtreeSpecificationParser ssParser
private PartitionNexus nexus
public SubentryInterceptor()
public void init(DirectoryService directoryService) throws org.apache.directory.api.ldap.model.exception.LdapException
init in interface Interceptorinit in class BaseInterceptordirectoryService - The DirectoryService instanceorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.Set<org.apache.directory.api.ldap.model.subtree.AdministrativeRole> getSubentryAdminRoles(org.apache.directory.api.ldap.model.entry.Entry subentry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean isSubentryVisible(OperationContext opContext) throws org.apache.directory.api.ldap.model.exception.LdapException
opContext - the invocation object to use for determining subentry visibilityjava.lang.Exception - if there are problems accessing request controlsorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void updateEntries(SubentryInterceptor.OperationEnum operation, CoreSession session, org.apache.directory.api.ldap.model.name.Dn subentryDn, org.apache.directory.api.ldap.model.name.Dn apDn, org.apache.directory.api.ldap.model.subtree.SubtreeSpecification ss, org.apache.directory.api.ldap.model.name.Dn baseDn, java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> operationalAttributes) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean isNamingContext(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 checkAdministrativeRole(OperationContext opContext, org.apache.directory.api.ldap.model.name.Dn apDn) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void setSubtreeSpecification(org.apache.directory.api.ldap.model.subtree.Subentry subentry,
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 hasAdministrativeDescendant(OperationContext opContext, org.apache.directory.api.ldap.model.name.Dn name) throws org.apache.directory.api.ldap.model.exception.LdapException
name - the name of the entry which is used as the search basejava.lang.Exception - if there are errors while searching the directoryorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Modification> getModsOnEntryRdnChange(org.apache.directory.api.ldap.model.name.Dn oldName,
org.apache.directory.api.ldap.model.name.Dn newName,
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 java.util.Set<org.apache.directory.api.ldap.model.subtree.AdministrativeRole> getSubentryTypes(org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> mods)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void getOperationalModForReplace(boolean hasRole,
org.apache.directory.api.ldap.model.schema.AttributeType attributeType,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> modifications)
throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException
org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueExceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Modification> getOperationalModsForReplace(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
org.apache.directory.api.ldap.model.subtree.Subentry subentry,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws java.lang.Exception
java.lang.Exceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> getSubentryOperationalAttributes(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.subtree.Subentry subentry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Modification> getOperationalModsForRemove(org.apache.directory.api.ldap.model.name.Dn subentryDn,
org.apache.directory.api.ldap.model.entry.Entry candidate)
throws org.apache.directory.api.ldap.model.exception.LdapException
subentryDn - the distinguished name of the subentrycandidate - the candidate entry to removed from theorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Modification> getOperationalModsForAdd(org.apache.directory.api.ldap.model.entry.Entry entry,
java.util.List<org.apache.directory.api.ldap.model.entry.Attribute> operationalAttributes)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.util.List<org.apache.directory.api.ldap.model.entry.Modification> getModsOnEntryModification(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry oldEntry,
org.apache.directory.api.ldap.model.entry.Entry newEntry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void setOperationalAttribute(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Dn subentryDn,
org.apache.directory.api.ldap.model.schema.AttributeType opAttr)
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 void delete(DeleteOperationContext deleteContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#delete( DeleteOperationContext ) call.delete in interface Interceptordelete 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 move(MoveOperationContext moveContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Case 1 :
A normal entry (ie, not a subentry or an AP) may be part of some administrative areas.
We have to remove the references to the associated areas if the entry gets out of them.
This entry can also be moved to some other administrative area, and it should then be
updated to point to the associated subentries.
There is one preliminary condition : If the entry has a descendant which is an
Administrative Point, then the move cannot be done.
Case 2 :
The subentry has to be moved under a new AP, otherwise this is an error. Once moved,
we have to update all the entries selected by the old subtreeSpecification, removing
the references to the subentry from all the selected entry, and update the entries
selected by the new subtreeSpecification by adding a reference to the subentry into them.
Case 3 :
move in interface Interceptormove in class BaseInterceptornext - The next interceptor in the chainmoveContext - The context containing all the needed informations to proceedorg.apache.directory.api.ldap.model.exception.LdapException - If the move failedpublic void moveAndRename(MoveAndRenameOperationContext moveAndRenameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition#moveAndRename( MoveAndRenameOperationContext) call.moveAndRename in interface InterceptormoveAndRename 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.LdapException