com.atlassian.crowd.integration.directory.connector.spring
Class RemotePrincipalAttributesMapper

java.lang.Object
  extended by com.atlassian.crowd.integration.directory.connector.spring.RemotePrincipalAttributesMapper
All Implemented Interfaces:
org.springframework.ldap.core.AttributesMapper

public class RemotePrincipalAttributesMapper
extends java.lang.Object
implements org.springframework.ldap.core.AttributesMapper

Maps an LDAP Attributes object to the Crowd {RemotePrincipal} object type, and vice versa.


Constructor Summary
RemotePrincipalAttributesMapper()
           
RemotePrincipalAttributesMapper(LDAPPropertiesMapper ldapPropertiesMapper)
           
RemotePrincipalAttributesMapper(LDAPPropertiesMapper ldapPropertiesMapper, boolean loadAttributes)
           
 
Method Summary
protected  java.util.List mapAttribute(javax.naming.directory.Attribute directoryAttribute)
          Translates an LDAP attribute into a list of Strings.
 javax.naming.directory.Attributes mapAttributesFromRemotePrincipal(RemotePrincipal remotePrincipal)
          Creates an LDAP Attributes object containing the information in the RemotePrincipal object.
 java.lang.Object mapFromAttributes(javax.naming.directory.Attributes attributes)
          Maps an LDAP object to the Crowd {RemotePrincipal} object type.
protected  void mapRemotePrincipalFromAttribute(java.lang.String remotePrincipalAttributeName, RemotePrincipal remotePrincipal, java.lang.String directoryAttributeName, javax.naming.directory.Attributes directoryAttributes)
          Obtains a single value for a {RemotePrincipal} from an LDAP attribute.
 RemotePrincipal mapRemotePrincipalFromAttributes(javax.naming.directory.Attributes directoryAttributes)
          Creates a RemotePrincipal object containing the information in the Attributes object.
 void setLdapPropertiesMapper(LDAPPropertiesMapper ldapPropertiesMapper)
           
 void setLoadAttributes(boolean loadAttributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePrincipalAttributesMapper

public RemotePrincipalAttributesMapper()

RemotePrincipalAttributesMapper

public RemotePrincipalAttributesMapper(LDAPPropertiesMapper ldapPropertiesMapper)

RemotePrincipalAttributesMapper

public RemotePrincipalAttributesMapper(LDAPPropertiesMapper ldapPropertiesMapper,
                                       boolean loadAttributes)
Method Detail

setLdapPropertiesMapper

public void setLdapPropertiesMapper(LDAPPropertiesMapper ldapPropertiesMapper)

setLoadAttributes

public void setLoadAttributes(boolean loadAttributes)

mapFromAttributes

public java.lang.Object mapFromAttributes(javax.naming.directory.Attributes attributes)
                                   throws org.springframework.ldap.NamingException
Maps an LDAP object to the Crowd {RemotePrincipal} object type. Implementation of AttributesMapper from Spring LDAP framework.

Specified by:
mapFromAttributes in interface org.springframework.ldap.core.AttributesMapper
Parameters:
attributes - The principal from the LDAP server to map into a {RemotePrincipal} object.
Returns:
The populated {RemotePrincipal}.
Throws:
org.springframework.ldap.NamingException - A mapping exception occured.
See Also:
AttributesMapper.mapFromAttributes(javax.naming.directory.Attributes)

mapAttributesFromRemotePrincipal

public javax.naming.directory.Attributes mapAttributesFromRemotePrincipal(RemotePrincipal remotePrincipal)
                                                                   throws org.springframework.ldap.NamingException
Creates an LDAP Attributes object containing the information in the RemotePrincipal object.

Parameters:
remotePrincipal - The object to take the values from
Returns:
A populated directory-specific Attributes object.
Throws:
org.springframework.ldap.NamingException

mapRemotePrincipalFromAttributes

public RemotePrincipal mapRemotePrincipalFromAttributes(javax.naming.directory.Attributes directoryAttributes)
                                                 throws org.springframework.ldap.NamingException
Creates a RemotePrincipal object containing the information in the Attributes object.

Parameters:
directoryAttributes - The directory-specific {Attributes} object to take the values from
Returns:
A populated {RemotePrincipal} object.
Throws:
org.springframework.ldap.NamingException

mapRemotePrincipalFromAttribute

protected void mapRemotePrincipalFromAttribute(java.lang.String remotePrincipalAttributeName,
                                               RemotePrincipal remotePrincipal,
                                               java.lang.String directoryAttributeName,
                                               javax.naming.directory.Attributes directoryAttributes)
                                        throws org.springframework.ldap.NamingException
Obtains a single value for a {RemotePrincipal} from an LDAP attribute.

Parameters:
remotePrincipalAttributeName - The name of the attribute whose value is being obtained
remotePrincipal - The object to place the attribute into.
directoryAttributeName - The name of the attribute in the target directory
directoryAttributes - The attributes object to fetch the the attribute from
Throws:
org.springframework.ldap.NamingException

mapAttribute

protected java.util.List mapAttribute(javax.naming.directory.Attribute directoryAttribute)
                               throws org.springframework.ldap.NamingException
Translates an LDAP attribute into a list of Strings. LDAP attributes can be multi-valued. Any attributes with invalid XML characters are filtered out. [CWD-109]

Parameters:
directoryAttribute - LDAP attribute.
Returns:
List of Strings.
Throws:
org.springframework.ldap.NamingException - An LDAP name exception occured.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.