Class CrowdLdapNameFactory

java.lang.Object
com.atlassian.crowd.directory.ldap.name.CrowdLdapNameFactory

public final class CrowdLdapNameFactory extends Object

A singleton factory class responsible for generating and managing CrowdLdapName instances. It leverages caching for optimal performance, storing and retrieving instances using the LDAP's Distinguished Name (DN) as the unique key.

An example DN might look like: cn=John Doe,ou=Users,dc=example,dc=com

Usage example:

     String dn = ...
     CrowdLdapName name = CrowdLdapNameFactory.getInstance().get(dn);
 

This class also supports creation of CrowdLdapName instances using a list of Relative Distinguished Names (RDNs).

     List<Rdn> rdns = ...
     CrowdLdapName name = CrowdLdapNameFactory.getInstance().get(rdns);
 

Additionally, this class collects and maintains usage metrics. These can be retrieved using the getStatsSummary() method, providing insight into cache performance and usage patterns.

Since:
5.3.0
See Also:
  • Method Details

    • getInstance

      public static CrowdLdapNameFactory getInstance()
    • getEmptyLdapName

      public CrowdLdapName getEmptyLdapName()
    • get

      public CrowdLdapName get(List<Rdn> rdnList)
    • get

      This method does not include DN validation or sanitization. Make sure the input string is not from user input or has been properly sanitized.
      Parameters:
      dn - The input distinguished name (DN) to be processed.
      Returns:
      An immutable wrapper of LdapName.
      Throws:
      LdapNameFormatException
    • clearCache

      public void clearCache()
    • resetMetrics

      public void resetMetrics()
    • getStatsSummary

      public String getStatsSummary()
    • getCacheSize

      public long getCacheSize()