Class LDAPConnectionHandlerConfiguration
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.LDAPConnectionHandlerConfiguration
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<LDAPConnectionHandlerConfiguration>
,java.util.Comparator<LDAPConnectionHandlerConfiguration>
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPConnectionHandlerConfiguration extends java.lang.Object implements java.lang.Comparable<LDAPConnectionHandlerConfiguration>, java.util.Comparator<LDAPConnectionHandlerConfiguration>, java.io.Serializable
This class provides a data structure that holds information about an LDAP connection handler defined in the configuration of a Ping Identity Directory Server instance. It also provides a utility method for reading a Directory Server configuration file to obtain information about the listener instances it contains, and it implements theComparable
interface for ranking connection handlers by relative preference for use.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(LDAPConnectionHandlerConfiguration c1, LDAPConnectionHandlerConfiguration c2)
Compares the provided configurations to determine their relative orders in which they should appear in a supported list.int
compareTo(LDAPConnectionHandlerConfiguration config)
Compares the provided configuration to this configuration to determine the relative orders in which they should appear in a supported list.boolean
equals(java.lang.Object o)
Indicates whether the provided object is considered logically equivalent to this LDAP connection handler configuration.java.util.List<java.lang.String>
getListenAddresses()
Retrieves the set of addresses on which the connection handler accepts client connections, if available.java.lang.String
getName()
Retrieves the name for the connection handler.int
getPort()
Retrieves the port on which the connection handler accepts client connections.int
hashCode()
Retrieves a hash code for the connection handler configuration.boolean
isEnabled()
Indicates whether the connection handler is enabled for use.static java.util.List<LDAPConnectionHandlerConfiguration>
readConfiguration(java.io.File configFile, boolean onlyEnabled)
Retrieves the LDAP connection handler configuration objects from the specified configuration file.boolean
supportsStartTLS()
Indicates whether the connection handler supports StartTLS for encrypting communication.java.lang.String
toString()
Retrieves a string representation of this LDAP connection handler configuration.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection handler configuration to the provided buffer.boolean
usesSSL()
Indicates whether the connection handler uses SSL to encrypt communication.
-
-
-
Method Detail
-
getName
@NotNull public java.lang.String getName()
Retrieves the name for the connection handler.- Returns:
- The name for the connection handler.
-
isEnabled
public boolean isEnabled()
Indicates whether the connection handler is enabled for use.- Returns:
true
if the connection handler is enabled, orfalse
if not.
-
getListenAddresses
@NotNull public java.util.List<java.lang.String> getListenAddresses()
Retrieves the set of addresses on which the connection handler accepts client connections, if available.- Returns:
- The set of addresses on which the connection handler accepts client connections, or an empty set if the connection handler listens on all addresses on all interfaces.
-
getPort
public int getPort()
Retrieves the port on which the connection handler accepts client connections.- Returns:
- The port on which the connection handler accepts client connections.
-
usesSSL
public boolean usesSSL()
Indicates whether the connection handler uses SSL to encrypt communication.- Returns:
true
if the connection handler uses SSL to encrypt communication, orfalse
if not.
-
supportsStartTLS
public boolean supportsStartTLS()
Indicates whether the connection handler supports StartTLS for encrypting communication.- Returns:
true
if the connection handler supports StartTLS for encrypting communication, orfalse
if not.
-
readConfiguration
@NotNull public static java.util.List<LDAPConnectionHandlerConfiguration> readConfiguration(@NotNull java.io.File configFile, boolean onlyEnabled) throws LDAPException
Retrieves the LDAP connection handler configuration objects from the specified configuration file. The configuration objects will be ordered from most preferred to least preferred, using the logic described in thecompareTo(com.unboundid.ldap.sdk.unboundidds.LDAPConnectionHandlerConfiguration)
method documentation.- Parameters:
configFile
- The configuration file to examine. It must not benull
, and it must exist.onlyEnabled
- Indicates whether to only include information about connection handlers that are enabled.- Returns:
- A list of the LDAP connection handler configuration objects read from the specified configuration file, or an empty set if no LDAP connection handler configuration entries were found in the configuration.
- Throws:
LDAPException
- If a problem interferes with reading the connection handler configuration objects from the configuration file.
-
hashCode
public int hashCode()
Retrieves a hash code for the connection handler configuration.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for the connection handler configuration.
-
equals
public boolean equals(@Nullable java.lang.Object o)
Indicates whether the provided object is considered logically equivalent to this LDAP connection handler configuration.- Specified by:
equals
in interfacejava.util.Comparator<LDAPConnectionHandlerConfiguration>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- If the provided object is considered logically equivalent to this LDAP connection handler configuration, orfalse
if not.
-
compareTo
public int compareTo(@Nullable LDAPConnectionHandlerConfiguration config)
Compares the provided configuration to this configuration to determine the relative orders in which they should appear in a supported list. Sorting will use the following criteria:- Connection handlers that are enabled will be ordered before those that are disabled.
- Connection handlers that use SSL will be ordered before those that support StartTLS, and those that support StartTLS will be ordered before those that do not support StartTLS.
- An SSL-enabled connection handler named "LDAPS Connection Handler" will be ordered before an SSL-enabled connection handler with some other name. A non-SSL-enabled connection handler named "LDAP Connection Handler" will be ordered before a non-SSL-enabled connection handler with some other name.
- Connection handlers that do not use listen addresses (and therefore listen on all interfaces) will be ordered before those that are configured with one or more listen addresses.
- Connection handlers with a lower port number will be ordered before those with a higher port number.
- As a last resort, then connection handlers will be ordered lexicographically by name.
- Specified by:
compareTo
in interfacejava.lang.Comparable<LDAPConnectionHandlerConfiguration>
- Parameters:
config
- The LDAP connection handler configuration to compare against this configuration.- Returns:
- A negative value if this configuration should be ordered before the provided configuration, a positive value if the provided configuration should be ordered before this configuration, or zero if the configurations are considered logically equivalent.
-
compare
public int compare(@NotNull LDAPConnectionHandlerConfiguration c1, @NotNull LDAPConnectionHandlerConfiguration c2)
Compares the provided configurations to determine their relative orders in which they should appear in a supported list. Sorting will use the criteria described in the documentation for thecompareTo(com.unboundid.ldap.sdk.unboundidds.LDAPConnectionHandlerConfiguration)
method.- Specified by:
compare
in interfacejava.util.Comparator<LDAPConnectionHandlerConfiguration>
- Parameters:
c1
- The first LDAP connection handler configuration to compare.c2
- The second LDAP connection handler configuration to compare.- Returns:
- A negative value if the first configuration should be ordered before the second configuration, a positive value if the first configuration should be ordered after the second configuration, or zero if the configurations are considered logically equivalent.
-
toString
@NotNull public java.lang.String toString()
Retrieves a string representation of this LDAP connection handler configuration.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this LDAP connection handler configuration.
-
-