Class ServerLoader

  • All Implemented Interfaces:
    Runnable

    public class ServerLoader
    extends Thread
    Class used to load the configuration of a server. Basically the code uses some provided properties and authentication information to connect to the server and then generate a ServerDescriptor object based on the read configuration.
    • Constructor Detail

      • ServerLoader

        public ServerLoader​(Map<ADSContext.ServerProperty,​Object> serverProperties,
                            DN dn,
                            String pwd,
                            ApplicationTrustManager trustManager,
                            int timeout,
                            Set<PreferredConnection> preferredLDAPURLs,
                            TopologyCacheFilter filter)
        Constructor.
        Parameters:
        serverProperties - the server properties of the server we want to load.
        dn - the DN that we must use to bind to the server.
        pwd - the password that we must use to bind to the server.
        trustManager - the ApplicationTrustManager to be used when we try to connect to the server.
        timeout - the timeout to establish the connection in milliseconds. Use 0 to express no timeout.
        preferredLDAPURLs - the list of preferred LDAP URLs that we want to use to connect to the server. They will be used only if they correspond to the URLs that we found in the the server properties.
        filter - the topology cache filter to be used. This can be used not to retrieve all the information.
    • Method Detail

      • getServerDescriptor

        public ServerDescriptor getServerDescriptor()
        Returns the ServerDescriptor that could be retrieved.
        Returns:
        the ServerDescriptor that could be retrieved.
      • getLastException

        public TopologyCacheException getLastException()
        Returns the last exception that occurred while trying to generate the ServerDescriptor object.
        Returns:
        the last exception that occurred while trying to generate the ServerDescriptor object.
      • interrupt

        public void interrupt()
        Overrides:
        interrupt in class Thread
      • run

        public void run()
        The method where we try to generate the ServerDescriptor object.
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • toHostPort

        public static HostPort toHostPort​(String ldapUrl)
                                   throws LdapException
        Converts an ldapUrl to a HostPort.
        Parameters:
        ldapUrl - the ldapUrl to convert
        Returns:
        the host and port extracted from the ldapUrl
        Throws:
        LdapException - if the ldapUrl is not a valid URL