Package org.ldaptive
Class LdapURL
- java.lang.Object
-
- org.ldaptive.LdapURL
-
-
Field Summary
Fields Modifier and Type Field Description private booleanactiveFalse if the last connection attempt to this URL failed, which should result in updatingretryMetadata, otherwise true.private static intHASH_CODE_SEEDhash code seed.private InetAddressinetAddressIP address resolved for this URL.private longpriorityPriority of this URL.private LdapURLRetryMetadataretryMetadataMetadata that describes connection failures on this URL.private UrlurlParsed URL properties.
-
Constructor Summary
Constructors Modifier Constructor Description privateLdapURL()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.privateLdapURL(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) voidactivate()Marks this URL as active.static LdapURLcopy(LdapURL ldapURL)Returns a new ldap URL initialized with the supplied URL.(package private) voiddeactivate()Marks this URL as inactive.booleanequals(Object o)StringgetHostname()Returns the hostname.StringgetHostnameWithPort()Returns the hostname:port.StringgetHostnameWithSchemeAndPort()Returns the scheme://hostname:port.InetAddressgetInetAddress()Returns the resolved IP address.intgetPort()Returns the port.longgetPriority()Returns the priority of this URL.(package private) LdapURLRetryMetadatagetRetryMetadata()Returns the retry metadata.StringgetScheme()Returns the scheme.UrlgetUrl()inthashCode()(package private) booleanisActive()Returns whether this URL is currently active.booleanisSchemeLdaps()Returns 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.StringtoString()
-
-
-
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
-
-