Package org.ldaptive

Class LdapURLSet


  • public final class LdapURLSet
    extends Object
    A set of LDAP URLs with helper functions for common connection strategies.
    • Field Detail

      • urls

        private final List<LdapURL> urls
        List of LDAP URLs to connect to in the order provided by the connection strategy.
    • Constructor Detail

      • LdapURLSet

        public LdapURLSet​(ConnectionStrategy strategy,
                          String ldapUrls)
        Creates a new LDAP URL set.
        Parameters:
        strategy - Connection strategy.
        ldapUrls - Space-delimited string of URLs describing the LDAP hosts to connect to. The URLs in the string are commonly ldap:// or ldaps:// URLs that directly describe the hosts to connect to, but may also describe a resource from which to obtain LDAP connection URLs as is the case for DnsSrvConnectionStrategy that use URLs with the scheme dns:.
    • Method Detail

      • getUrls

        public List<LdapURL> getUrls()
        Returns the URLs in this set with active URLs ordered before inactive.
        Returns:
        URLs with active ordered before inactive
      • hasActiveUrls

        public boolean hasActiveUrls()
        Returns whether this set has any active URLs.
        Returns:
        whether there are any active LDAP URLs in the set, false otherwise.
      • getActiveUrls

        public List<LdapURL> getActiveUrls()
        Returns the active URLs.
        Returns:
        list of active URLs in order they were added.
      • hasInactiveUrls

        public boolean hasInactiveUrls()
        Returns whether this set has any inactive URLs.
        Returns:
        whether there are any inactive LDAP URLs in the set, false otherwise.
      • getInactiveUrls

        public List<LdapURL> getInactiveUrls()
        Returns the inactive URLs.
        Returns:
        list of inactive URLs in order they were added.
      • size

        public int size()
        Returns the number of URLs in this set.
        Returns:
        number of URLs in this set
      • populate

        void populate​(List<LdapURL> ldapUrls)
        Populates this set with a list of URLs in the order produced by ConnectionStrategy.populate(String, LdapURLSet). This method MUST be called before the set is used, but MAY be called subsequently periodically to refresh the set of LDAP URLs.
        Parameters:
        ldapUrls - LDAP URLs to add to this set.