Package org.nuxeo.ecm.directory.ldap
Class LDAPReference
java.lang.Object
org.nuxeo.ecm.directory.AbstractReference
org.nuxeo.ecm.directory.ldap.LDAPReference
Implementation of the directory Reference interface that leverage two common ways of storing relationships in LDAP
directories:
- the static attribute strategy where a multi-valued attribute store the exhaustive list of distinguished names of the refereed entries (eg. the uniqueMember attribute of the groupOfUniqueNames objectclass)
- the dynamic attribute strategy where a potentially multi-valued attribute stores a ldap urls intensively describing the refereed LDAP entries (eg. the memberURLs attribute of the groupOfURLs objectclass)
Please note that both static and dynamic references are resolved in read mode whereas only the static attribute strategy is used when creating new references or when deleting existing ones (write / update mode).
Some design considerations behind the implementation of such reference can be found at: http://jira.nuxeo.org/browse/NXP-1506
- Author:
- Olivier Grisel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringbooleanprotected Stringprotected LDAPDirectoryDescriptorFields inherited from class org.nuxeo.ecm.directory.AbstractReference
fieldName, sourceDirectory, sourceDirectoryName, targetDirectory, targetDirectoryName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStore new links using the LDAP staticAttributeId strategy.voidAdds the links between the source id and the target idsvoidStore new links using the LDAP staticAttributeId strategy.voidAdds the links between the source ids and the target idclone()protected StringgetIdForDn(LDAPSession session, String dn) getLdapTargetIds(Attributes attributes) Optimized method to spare a LDAP request when the caller is a LDAPSession object that has already fetched the LDAP Attribute instances.getSourceIdsForTarget(String targetId) Fetch both statically and dynamically defined references and merge the results.protected LDAPDirectorygetStaticAttributeId(DirectoryFieldMapper sourceFM) protected LDAPDirectoryDescriptorgetTargetIdsForSource(String sourceId) Fetches both statically and dynamically defined references and merges the results.protected LDAPDirectorybooleanbooleanisStatic()protected static StringSimple helper that replaces ", " by "," in the provided dn and returns the lower case version of the result for comparison purpose.voidremoveLinksForSource(String sourceId) Remove existing statically defined links for the given source id (dynamic references remain unaltered)voidremoveLinksForSource(String sourceId, Session session) Removes all the links for a given source idvoidremoveLinksForTarget(String targetId) Remove existing statically defined links for the given target id (dynamic references remain unaltered)voidremoveLinksForTarget(String targetId, Session session) Removes all the links for a given target idvoidsetFieldName(String fieldName) voidsetSourceIdsForTarget(String targetId, List<String> sourceIds) Edit the list of statically defined references for a given target (dynamic references remain unaltered)voidsetSourceIdsForTarget(String targetId, List<String> sourceIds, Session session) Sets all source ids to be associated to the given target idvoidsetTargetDirectoryName(String targetDirectoryName) voidsetTargetIdsForSource(String sourceId, List<String> targetIds) Set the list of statically defined references for a given source (dynamic references remain unaltered)voidsetTargetIdsForSource(String sourceId, List<String> targetIds, Session session) Sets all target ids to be associated to the given source idtoString()Methods inherited from class org.nuxeo.ecm.directory.AbstractReference
getFieldName, setSourceDirectoryName
-
Field Details
-
forceDnConsistencyCheck
public boolean forceDnConsistencyCheck -
targetDirectoryDescriptor
-
staticAttributeId
-
dynamicAttributeId
-
-
Constructor Details
-
LDAPReference
public LDAPReference() -
LDAPReference
-
-
Method Details
-
setFieldName
-
isStatic
public boolean isStatic()- Returns:
- true if the reference should resolve statically refereed entries (identified by dn-valued attribute)
-
getStaticAttributeId
-
getStaticAttributeId
-
getDynamicAttributes
-
getDynamicAttributeId
-
isDynamic
public boolean isDynamic()- Returns:
- true if the reference should resolve dynamically refereed entries (identified by a LDAP url-valued attribute)
-
setTargetDirectoryName
- Specified by:
setTargetDirectoryNamein interfaceReference- Overrides:
setTargetDirectoryNamein classAbstractReference
-
getSourceDirectory
- Specified by:
getSourceDirectoryin interfaceReference- Overrides:
getSourceDirectoryin classAbstractReference
-
getTargetDirectory
- Specified by:
getTargetDirectoryin interfaceReference- Overrides:
getTargetDirectoryin classAbstractReference
-
getTargetLDAPDirectory
-
getSourceLDAPDirectory
-
getTargetDirectoryDescriptor
-
addLinks
Store new links using the LDAP staticAttributeId strategy. -
addLinks
Store new links using the LDAP staticAttributeId strategy. -
getSourceIdsForTarget
Fetch both statically and dynamically defined references and merge the results.- Specified by:
getSourceIdsForTargetin interfaceReference- See Also:
-
getTargetIdsForSource
Fetches both statically and dynamically defined references and merges the results.- Specified by:
getTargetIdsForSourcein interfaceReference- See Also:
-
pseudoNormalizeDn
Simple helper that replaces ", " by "," in the provided dn and returns the lower case version of the result for comparison purpose.- Parameters:
dn- the raw unnormalized dn- Returns:
- lowercase version without whitespace after commas
- Throws:
InvalidNameException
-
getLdapTargetIds
Optimized method to spare a LDAP request when the caller is a LDAPSession object that has already fetched the LDAP Attribute instances.This method should return the same results as the sister method: org.nuxeo .ecm.directory.Reference#getTargetIdsForSource(java.lang.String)
- Returns:
- target reference ids
-
getIdForDn
-
removeLinksForSource
Remove existing statically defined links for the given source id (dynamic references remain unaltered)- Specified by:
removeLinksForSourcein interfaceReference- See Also:
-
removeLinksForTarget
Remove existing statically defined links for the given target id (dynamic references remain unaltered)- Specified by:
removeLinksForTargetin interfaceReference- See Also:
-
setSourceIdsForTarget
Edit the list of statically defined references for a given target (dynamic references remain unaltered)- Specified by:
setSourceIdsForTargetin interfaceReference- See Also:
-
setSourceIdsForTarget
Description copied from interface:ReferenceSets all source ids to be associated to the given target id- Specified by:
setSourceIdsForTargetin interfaceReference- Parameters:
targetId- the target idsourceIds- the source idssession- the session
-
setTargetIdsForSource
Set the list of statically defined references for a given source (dynamic references remain unaltered)- Specified by:
setTargetIdsForSourcein interfaceReference- See Also:
-
setTargetIdsForSource
Description copied from interface:ReferenceSets all target ids to be associated to the given source id- Specified by:
setTargetIdsForSourcein interfaceReference- Parameters:
sourceId- the source idtargetIds- the target idssession- the session
-
removeLinksForTarget
Description copied from interface:ReferenceRemoves all the links for a given target id- Specified by:
removeLinksForTargetin interfaceReference- Parameters:
targetId- the target idsession- the session
-
removeLinksForSource
Description copied from interface:ReferenceRemoves all the links for a given source id- Specified by:
removeLinksForSourcein interfaceReference- Parameters:
sourceId- the source idsession- the session
-
toString
-
clone
-
addLinks
Description copied from interface:ReferenceAdds the links between the source id and the target ids -
addLinks
Description copied from interface:ReferenceAdds the links between the source ids and the target id
-