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
Modifier and TypeFieldDescriptionprotected String
boolean
protected String
protected LDAPDirectoryDescriptor
Fields inherited from class org.nuxeo.ecm.directory.AbstractReference
fieldName, sourceDirectory, sourceDirectoryName, targetDirectory, targetDirectoryName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Store new links using the LDAP staticAttributeId strategy.void
Adds the links between the source id and the target idsvoid
Store new links using the LDAP staticAttributeId strategy.void
Adds the links between the source ids and the target idclone()
protected String
getIdForDn
(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 LDAPDirectory
getStaticAttributeId
(DirectoryFieldMapper sourceFM) protected LDAPDirectoryDescriptor
getTargetIdsForSource
(String sourceId) Fetches both statically and dynamically defined references and merges the results.protected LDAPDirectory
boolean
boolean
isStatic()
protected static String
Simple helper that replaces ", " by "," in the provided dn and returns the lower case version of the result for comparison purpose.void
removeLinksForSource
(String sourceId) Remove existing statically defined links for the given source id (dynamic references remain unaltered)void
removeLinksForSource
(String sourceId, Session session) Removes all the links for a given source idvoid
removeLinksForTarget
(String targetId) Remove existing statically defined links for the given target id (dynamic references remain unaltered)void
removeLinksForTarget
(String targetId, Session session) Removes all the links for a given target idvoid
setFieldName
(String fieldName) void
setSourceIdsForTarget
(String targetId, List<String> sourceIds) Edit the list of statically defined references for a given target (dynamic references remain unaltered)void
setSourceIdsForTarget
(String targetId, List<String> sourceIds, Session session) Sets all source ids to be associated to the given target idvoid
setTargetDirectoryName
(String targetDirectoryName) void
setTargetIdsForSource
(String sourceId, List<String> targetIds) Set the list of statically defined references for a given source (dynamic references remain unaltered)void
setTargetIdsForSource
(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:
setTargetDirectoryName
in interfaceReference
- Overrides:
setTargetDirectoryName
in classAbstractReference
-
getSourceDirectory
- Specified by:
getSourceDirectory
in interfaceReference
- Overrides:
getSourceDirectory
in classAbstractReference
-
getTargetDirectory
- Specified by:
getTargetDirectory
in interfaceReference
- Overrides:
getTargetDirectory
in 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:
getSourceIdsForTarget
in interfaceReference
- See Also:
-
getTargetIdsForSource
Fetches both statically and dynamically defined references and merges the results.- Specified by:
getTargetIdsForSource
in 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:
removeLinksForSource
in interfaceReference
- See Also:
-
removeLinksForTarget
Remove existing statically defined links for the given target id (dynamic references remain unaltered)- Specified by:
removeLinksForTarget
in interfaceReference
- See Also:
-
setSourceIdsForTarget
Edit the list of statically defined references for a given target (dynamic references remain unaltered)- Specified by:
setSourceIdsForTarget
in interfaceReference
- See Also:
-
setSourceIdsForTarget
Description copied from interface:Reference
Sets all source ids to be associated to the given target id- Specified by:
setSourceIdsForTarget
in 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:
setTargetIdsForSource
in interfaceReference
- See Also:
-
setTargetIdsForSource
Description copied from interface:Reference
Sets all target ids to be associated to the given source id- Specified by:
setTargetIdsForSource
in interfaceReference
- Parameters:
sourceId
- the source idtargetIds
- the target idssession
- the session
-
removeLinksForTarget
Description copied from interface:Reference
Removes all the links for a given target id- Specified by:
removeLinksForTarget
in interfaceReference
- Parameters:
targetId
- the target idsession
- the session
-
removeLinksForSource
Description copied from interface:Reference
Removes all the links for a given source id- Specified by:
removeLinksForSource
in interfaceReference
- Parameters:
sourceId
- the source idsession
- the session
-
toString
-
clone
-
addLinks
Description copied from interface:Reference
Adds the links between the source id and the target ids -
addLinks
Description copied from interface:Reference
Adds the links between the source ids and the target id
-