Package org.ldaptive
Class LdapURL
- java.lang.Object
-
- org.ldaptive.LdapURL
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
active
False if the last connection attempt to this URL failed, which should result in updatingretryMetadata
, otherwise true.private static int
HASH_CODE_SEED
hash code seed.private InetAddress
inetAddress
IP address resolved for this URL.private long
priority
Priority of this URL.private LdapURLRetryMetadata
retryMetadata
Metadata that describes connection failures on this URL.private Url
url
Parsed URL properties.
-
Constructor Summary
Constructors Modifier Constructor Description private
LdapURL()
Private constructor.LdapURL(String ldapUrl)
Creates a new ldap url.LdapURL(String hostname, int port)
Creates a new ldap url.LdapURL(String ldapUrl, UrlParser parser)
Creates a new ldap url.private
LdapURL(Url ldapURL)
Creates a new LDAP URL with the suppliedUrl
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
activate()
Marks this URL as active.static LdapURL
copy(LdapURL ldapURL)
Returns a new ldap URL initialized with the supplied URL.(package private) void
deactivate()
Marks this URL as inactive.boolean
equals(Object o)
String
getHostname()
Returns the hostname.String
getHostnameWithPort()
Returns the hostname:port.String
getHostnameWithSchemeAndPort()
Returns the scheme://hostname:port.InetAddress
getInetAddress()
Returns the resolved IP address.int
getPort()
Returns the port.long
getPriority()
Returns the priority of this URL.(package private) LdapURLRetryMetadata
getRetryMetadata()
Returns the retry metadata.String
getScheme()
Returns the scheme.Url
getUrl()
int
hashCode()
(package private) boolean
isActive()
Returns whether this URL is currently active.boolean
isSchemeLdaps()
Returns whether the scheme is 'ldaps'.(package private) void
setInetAddress(InetAddress address)
Sets the resolved IP address.(package private) void
setPriority(long p)
Sets the priority of this URL.(package private) void
setRetryMetadata(LdapURLRetryMetadata metadata)
Sets the retry metadata.String
toString()
-
-
-
Field Detail
-
HASH_CODE_SEED
private static final int HASH_CODE_SEED
hash code seed.- See Also:
- Constant Field Values
-
url
private Url url
Parsed URL properties.
-
retryMetadata
private LdapURLRetryMetadata retryMetadata
Metadata that describes connection failures on this URL.
-
active
private boolean active
False if the last connection attempt to this URL failed, which should result in updatingretryMetadata
, otherwise true.
-
inetAddress
private InetAddress inetAddress
IP address resolved for this URL.
-
priority
private long priority
Priority of this URL. Lower numbers indicate higher priority.
-
-
Constructor Detail
-
LdapURL
private LdapURL()
Private constructor.
-
LdapURL
private LdapURL(Url ldapURL)
Creates a new LDAP URL with the suppliedUrl
.- Parameters:
ldapURL
- to set
-
LdapURL
public LdapURL(String hostname, int port)
Creates a new ldap url.- Parameters:
hostname
- LDAP server hostnameport
- TCP port the LDAP server is listening on
-
LdapURL
public LdapURL(String ldapUrl)
Creates a new ldap url.- Parameters:
ldapUrl
- string representation of LDAP URL
-
-
Method Detail
-
getScheme
public String getScheme()
Returns the scheme.- Returns:
- scheme
-
isSchemeLdaps
public boolean isSchemeLdaps()
Returns whether the scheme is 'ldaps'.- Returns:
- whether the scheme is 'ldaps'
-
getHostname
public String 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
public Url getUrl()
-
getHostnameWithPort
public String getHostnameWithPort()
Returns the hostname:port.- Returns:
- hostname:port
-
getHostnameWithSchemeAndPort
public String 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
void setRetryMetadata(LdapURLRetryMetadata metadata)
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
public InetAddress getInetAddress()
Returns the resolved IP address.- Returns:
- resolved IP address for this URL.
-
setInetAddress
void setInetAddress(InetAddress address)
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
public static LdapURL copy(LdapURL ldapURL)
Returns a new ldap URL initialized with the supplied URL.- Parameters:
ldapURL
- ldap URL to read properties from- Returns:
- ldap URL
-
-