Package org.ldaptive
Class LdapURL
java.lang.Object
org.ldaptive.LdapURL
Class to represent an LDAP URL in order to make connections to an LDAP server. URL components are parsed according to
RFC 4516. See
Url-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFalse if the last connection attempt to this URL failed, which should result in updatingretryMetadata, otherwise true.private static final inthash code seed.private InetAddressIP address resolved for this URL.private longPriority of this URL.private LdapURLRetryMetadataMetadata that describes connection failures on this URL.private UrlParsed URL properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidactivate()Marks this URL as active.static LdapURLReturns a new ldap URL initialized with the supplied URL.(package private) voidMarks this URL as inactive.booleanReturns the hostname.Returns the hostname:port.Returns the scheme://hostname:port.Returns the resolved IP address.intgetPort()Returns the port.longReturns the priority of this URL.(package private) LdapURLRetryMetadataReturns the retry metadata.Returns the scheme.getUrl()inthashCode()(package private) booleanisActive()Returns whether this URL is currently active.booleanReturns whether the scheme is 'ldaps'.(package private) voidsetInetAddress(InetAddress address) Sets the resolved IP address.(package private) voidsetPriority(long p) Sets the priority of this URL.(package private) voidsetRetryMetadata(LdapURLRetryMetadata metadata) Sets the retry metadata.toString()
-
Field Details
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
url
Parsed URL properties. -
retryMetadata
Metadata that describes connection failures on this URL. -
active
private boolean activeFalse if the last connection attempt to this URL failed, which should result in updatingretryMetadata, otherwise true. -
inetAddress
IP address resolved for this URL. -
priority
private long priorityPriority of this URL. Lower numbers indicate higher priority.
-
-
Constructor Details
-
LdapURL
private LdapURL()Private constructor. -
LdapURL
Creates a new LDAP URL with the suppliedUrl.- Parameters:
ldapURL- to set
-
LdapURL
Creates a new ldap url.- Parameters:
hostname- LDAP server hostnameport- TCP port the LDAP server is listening on
-
LdapURL
Creates a new ldap url.- Parameters:
ldapUrl- string representation of LDAP URL
-
LdapURL
Creates a new ldap url.- Parameters:
ldapUrl- string representation of LDAP URLparser- to parse the url
-
-
Method Details
-
getScheme
Returns the scheme.- Returns:
- scheme
-
isSchemeLdaps
public boolean isSchemeLdaps()Returns whether the scheme is 'ldaps'.- Returns:
- whether the scheme is 'ldaps'
-
getHostname
Returns the hostname.- Returns:
- hostname
-
getPort
public int getPort()Returns the port. If no port was supplied, returns the default port for the scheme.- Returns:
- port
-
getUrl
-
getHostnameWithPort
Returns the hostname:port.- Returns:
- hostname:port
-
getHostnameWithSchemeAndPort
Returns the scheme://hostname:port.- Returns:
- scheme://hostname:port
-
getRetryMetadata
LdapURLRetryMetadata getRetryMetadata()Returns the retry metadata.- Returns:
- metadata describing retry attempts for connections made this URL.
-
setRetryMetadata
Sets the retry metadata.- Parameters:
metadata- retry metadata
-
isActive
boolean isActive()Returns whether this URL is currently active.- Returns:
- true if this URL can be connected to, false otherwise.
-
activate
void activate()Marks this URL as active. -
deactivate
void deactivate()Marks this URL as inactive. -
getInetAddress
Returns the resolved IP address.- Returns:
- resolved IP address for this URL.
-
setInetAddress
Sets the resolved IP address.- Parameters:
address- IP address for this URL
-
getPriority
public long getPriority()Returns the priority of this URL. Lower numbers indicate a higher priority.- Returns:
- priority for this URL.
-
setPriority
void setPriority(long p) Sets the priority of this URL.- Parameters:
p- priority for this URL
-
copy
Returns a new ldap URL initialized with the supplied URL.- Parameters:
ldapURL- ldap URL to read properties from- Returns:
- ldap URL
-
equals
-
hashCode
public int hashCode() -
toString
-