Package org.opends.server.types
Class LDAPURL
- java.lang.Object
-
- org.opends.server.types.LDAPURL
-
@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class LDAPURL extends Object
This class defines a data structure that represents the components of an LDAP URL, including the scheme, host, port, base DN, attributes, scope, filter, and extensions. It has the ability to create an LDAP URL based on all of these individual components, as well as parsing them from their string representations.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SCHEMEThe default scheme that will be used if none is provided.static SearchFilterDEFAULT_SEARCH_FILTERThe default search filter that will be used if none is provided.
-
Constructor Summary
Constructors Constructor Description LDAPURL(String scheme, String host, int port, String rawBaseDN, LinkedHashSet<String> attributes, SearchScope scope, String rawFilter, List<String> extensions)Creates a new LDAP URL with the provided information.LDAPURL(String scheme, String host, int port, DN baseDN, LinkedHashSet<String> attributes, SearchScope scope, SearchFilter filter, List<String> extensions)Creates a new LDAP URL with the provided information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LDAPURLdecode(String url, boolean fullyDecode)Decodes the provided string as an LDAP URL.booleanequals(Object o)Indicates whether the provided object is equal to this LDAP URL.LinkedHashSet<String>getAttributes()Retrieves the set of attributes for this LDAP URL.DNgetBaseDN()Retrieves the processed DN for this LDAP URL.List<String>getExtensions()Retrieves the set of extensions for this LDAP URL.SearchFiltergetFilter()Retrieves the processed search filter for this LDAP URL.StringgetHost()Retrieves the host for this LDAP URL.intgetPort()Retrieves the port for this LDAP URL.StringgetRawBaseDN()Retrieve the raw, unprocessed base DN for this LDAP URL.StringgetRawFilter()Retrieves the raw, unprocessed search filter for this LDAP URL.StringgetScheme()Retrieves the scheme for this LDAP URL.SearchScopegetScope()Retrieves the search scope for this LDAP URL.inthashCode()Retrieves the hash code for this LDAP URL.booleanmatchesEntry(Entry entry)Indicates whether the provided entry matches the criteria defined in this LDAP URL.voidsetBaseDN(DN baseDN)Specifies the base DN for this LDAP URL.voidsetFilter(SearchFilter filter)Specifies the search filter for this LDAP URL.voidsetHost(String host)Specifies the host for this LDAP URL.voidsetPort(int port)Specifies the port for this LDAP URL.voidsetRawBaseDN(String rawBaseDN)Specifies the raw, unprocessed base DN for this LDAP URL.voidsetRawFilter(String rawFilter)Specifies the raw, unprocessed search filter for this LDAP URL.voidsetScheme(String scheme)Specifies the scheme for this LDAP URL.voidsetScope(SearchScope scope)Specifies the search scope for this LDAP URL.StringtoString()Retrieves a string representation of this LDAP URL.voidtoString(StringBuilder buffer, boolean baseOnly)Appends a string representation of this LDAP URL to the provided buffer.
-
-
-
Field Detail
-
DEFAULT_SCHEME
public static final String DEFAULT_SCHEME
The default scheme that will be used if none is provided.- See Also:
- Constant Field Values
-
DEFAULT_SEARCH_FILTER
public static final SearchFilter DEFAULT_SEARCH_FILTER
The default search filter that will be used if none is provided.
-
-
Constructor Detail
-
LDAPURL
public LDAPURL(String scheme, String host, int port, String rawBaseDN, LinkedHashSet<String> attributes, SearchScope scope, String rawFilter, List<String> extensions)
Creates a new LDAP URL with the provided information.- Parameters:
scheme- The scheme (i.e., protocol) for this LDAP URL.host- The address for this LDAP URL.port- The port number for this LDAP URL.rawBaseDN- The raw base DN for this LDAP URL.attributes- The set of requested attributes for this LDAP URL.scope- The search scope for this LDAP URL.rawFilter- The string representation of the search filter for this LDAP URL.extensions- The set of extensions for this LDAP URL.
-
LDAPURL
public LDAPURL(String scheme, String host, int port, DN baseDN, LinkedHashSet<String> attributes, SearchScope scope, SearchFilter filter, List<String> extensions)
Creates a new LDAP URL with the provided information.- Parameters:
scheme- The scheme (i.e., protocol) for this LDAP URL.host- The address for this LDAP URL.port- The port number for this LDAP URL.baseDN- The base DN for this LDAP URL.attributes- The set of requested attributes for this LDAP URL.scope- The search scope for this LDAP URL.filter- The search filter for this LDAP URL.extensions- The set of extensions for this LDAP URL.
-
-
Method Detail
-
decode
public static LDAPURL decode(String url, boolean fullyDecode) throws DirectoryException
Decodes the provided string as an LDAP URL.- Parameters:
url- The URL string to be decoded.fullyDecode- Indicates whether the URL should be fully decoded (e.g., parsing the base DN and search filter) or just leaving them in their string representations. The latter may be required for client-side use.- Returns:
- The LDAP URL decoded from the provided string.
- Throws:
DirectoryException- If a problem occurs while attempting to decode the provided string as an LDAP URL.
-
getScheme
public String getScheme()
Retrieves the scheme for this LDAP URL.- Returns:
- The scheme for this LDAP URL.
-
setScheme
public void setScheme(String scheme)
Specifies the scheme for this LDAP URL.- Parameters:
scheme- The scheme for this LDAP URL.
-
getHost
public String getHost()
Retrieves the host for this LDAP URL.- Returns:
- The host for this LDAP URL, or
nullif none was provided.
-
setHost
public void setHost(String host)
Specifies the host for this LDAP URL.- Parameters:
host- The host for this LDAP URL.
-
getPort
public int getPort()
Retrieves the port for this LDAP URL.- Returns:
- The port for this LDAP URL.
-
setPort
public void setPort(int port)
Specifies the port for this LDAP URL.- Parameters:
port- The port for this LDAP URL.
-
getRawBaseDN
public String getRawBaseDN()
Retrieve the raw, unprocessed base DN for this LDAP URL.- Returns:
- The raw, unprocessed base DN for this LDAP URL, or
nullif none was given (in which case a default of the null DN "" should be assumed).
-
setRawBaseDN
public void setRawBaseDN(String rawBaseDN)
Specifies the raw, unprocessed base DN for this LDAP URL.- Parameters:
rawBaseDN- The raw, unprocessed base DN for this LDAP URL.
-
getBaseDN
public DN getBaseDN() throws DirectoryException
Retrieves the processed DN for this LDAP URL.- Returns:
- The processed DN for this LDAP URL.
- Throws:
DirectoryException- If the raw base DN cannot be decoded as a valid DN.
-
setBaseDN
public void setBaseDN(DN baseDN)
Specifies the base DN for this LDAP URL.- Parameters:
baseDN- The base DN for this LDAP URL.
-
getAttributes
public LinkedHashSet<String> getAttributes()
Retrieves the set of attributes for this LDAP URL. The contents of the returned set may be altered by the caller.- Returns:
- The set of attributes for this LDAP URL.
-
getScope
public SearchScope getScope()
Retrieves the search scope for this LDAP URL.- Returns:
- The search scope for this LDAP URL, or
nullif none was given (in which case the base-level scope should be assumed).
-
setScope
public void setScope(SearchScope scope)
Specifies the search scope for this LDAP URL.- Parameters:
scope- The search scope for this LDAP URL.
-
getRawFilter
public String getRawFilter()
Retrieves the raw, unprocessed search filter for this LDAP URL.- Returns:
- The raw, unprocessed search filter for this LDAP URL, or
nullif none was given (in which case a default filter of "(objectClass=*)" should be assumed).
-
setRawFilter
public void setRawFilter(String rawFilter)
Specifies the raw, unprocessed search filter for this LDAP URL.- Parameters:
rawFilter- The raw, unprocessed search filter for this LDAP URL.
-
getFilter
public SearchFilter getFilter() throws DirectoryException
Retrieves the processed search filter for this LDAP URL.- Returns:
- The processed search filter for this LDAP URL.
- Throws:
DirectoryException- If a problem occurs while attempting to decode the raw filter.
-
setFilter
public void setFilter(SearchFilter filter)
Specifies the search filter for this LDAP URL.- Parameters:
filter- The search filter for this LDAP URL.
-
getExtensions
public List<String> getExtensions()
Retrieves the set of extensions for this LDAP URL. The contents of the returned list may be altered by the caller.- Returns:
- The set of extensions for this LDAP URL.
-
matchesEntry
public boolean matchesEntry(Entry entry) throws DirectoryException
Indicates whether the provided entry matches the criteria defined in this LDAP URL.- Parameters:
entry- The entry for which to make the determination.- Returns:
trueif the provided entry does match the criteria specified in this LDAP URL, orfalseif it does not.- Throws:
DirectoryException- If a problem occurs while attempting to make the determination.
-
equals
public boolean equals(Object o)
Indicates whether the provided object is equal to this LDAP URL.
-
hashCode
public int hashCode()
Retrieves the hash code for this LDAP URL.
-
toString
public String toString()
Retrieves a string representation of this LDAP URL.
-
toString
public void toString(StringBuilder buffer, boolean baseOnly)
Appends a string representation of this LDAP URL to the provided buffer.- Parameters:
buffer- The buffer to which the information is to be appended.baseOnly- Indicates whether the resulting URL string should only include the portion up to the base DN, omitting the attributes, scope, filter, and extensions.
-
-