org.opends.server.types
Class LDAPURL

java.lang.Object
  extended by org.opends.server.types.LDAPURL

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class LDAPURL
extends java.lang.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
static DN DEFAULT_BASE_DN
          The default base DN that will be used if none is provided.
static int DEFAULT_PORT
          The default port value that will be used if none is provided.
static java.lang.String DEFAULT_SCHEME
          The default scheme that will be used if none is provided.
static SearchFilter DEFAULT_SEARCH_FILTER
          The default search filter that will be used if none is provided.
static SearchScope DEFAULT_SEARCH_SCOPE
          The default search scope that will be used if none is provided.
 
Constructor Summary
LDAPURL(java.lang.String scheme, java.lang.String host, int port, DN baseDN, java.util.LinkedHashSet<java.lang.String> attributes, SearchScope scope, SearchFilter filter, java.util.LinkedList<java.lang.String> extensions)
          Creates a new LDAP URL with the provided information.
LDAPURL(java.lang.String scheme, java.lang.String host, int port, java.lang.String rawBaseDN, java.util.LinkedHashSet<java.lang.String> attributes, SearchScope scope, java.lang.String rawFilter, java.util.LinkedList<java.lang.String> extensions)
          Creates a new LDAP URL with the provided information.
 
Method Summary
static LDAPURL decode(java.lang.String url, boolean fullyDecode)
          Decodes the provided string as an LDAP URL.
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this LDAP URL.
 java.util.LinkedHashSet<java.lang.String> getAttributes()
          Retrieves the set of attributes for this LDAP URL.
 DN getBaseDN()
          Retrieves the processed DN for this LDAP URL.
 java.util.LinkedList<java.lang.String> getExtensions()
          Retrieves the set of extensions for this LDAP URL.
 SearchFilter getFilter()
          Retrieves the processed search filter for this LDAP URL.
 java.lang.String getHost()
          Retrieves the host for this LDAP URL.
 int getPort()
          Retrieves the port for this LDAP URL.
 java.lang.String getRawBaseDN()
          Retrieve the raw, unprocessed base DN for this LDAP URL.
 java.lang.String getRawFilter()
          Retrieves the raw, unprocessed search filter for this LDAP URL.
 java.lang.String getScheme()
          Retrieves the scheme for this LDAP URL.
 SearchScope getScope()
          Retrieves the search scope for this LDAP URL.
 int hashCode()
          Retrieves the hash code for this LDAP URL.
 boolean matchesEntry(Entry entry)
          Indicates whether the provided entry matches the criteria defined in this LDAP URL.
 void setBaseDN(DN baseDN)
          Specifies the base DN for this LDAP URL.
 void setFilter(SearchFilter filter)
          Specifies the search filter for this LDAP URL.
 void setHost(java.lang.String host)
          Specifies the host for this LDAP URL.
 void setPort(int port)
          Specifies the port for this LDAP URL.
 void setRawBaseDN(java.lang.String rawBaseDN)
          Specifies the raw, unprocessed base DN for this LDAP URL.
 void setRawFilter(java.lang.String rawFilter)
          Specifies the raw, unprocessed search filter for this LDAP URL.
 void setScheme(java.lang.String scheme)
          Specifies the scheme for this LDAP URL.
 void setScope(SearchScope scope)
          Specifies the search scope for this LDAP URL.
 java.lang.String toString()
          Retrieves a string representation of this LDAP URL.
 void toString(java.lang.StringBuilder buffer, boolean baseOnly)
          Appends a string representation of this LDAP URL to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SCHEME

public static final java.lang.String DEFAULT_SCHEME
The default scheme that will be used if none is provided.

See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port value that will be used if none is provided.

See Also:
Constant Field Values

DEFAULT_BASE_DN

public static final DN DEFAULT_BASE_DN
The default base DN that will be used if none is provided.


DEFAULT_SEARCH_SCOPE

public static final SearchScope DEFAULT_SEARCH_SCOPE
The default search scope that will be used if none is provided.


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(java.lang.String scheme,
               java.lang.String host,
               int port,
               java.lang.String rawBaseDN,
               java.util.LinkedHashSet<java.lang.String> attributes,
               SearchScope scope,
               java.lang.String rawFilter,
               java.util.LinkedList<java.lang.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(java.lang.String scheme,
               java.lang.String host,
               int port,
               DN baseDN,
               java.util.LinkedHashSet<java.lang.String> attributes,
               SearchScope scope,
               SearchFilter filter,
               java.util.LinkedList<java.lang.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(java.lang.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 java.lang.String getScheme()
Retrieves the scheme for this LDAP URL.

Returns:
The scheme for this LDAP URL.

setScheme

public void setScheme(java.lang.String scheme)
Specifies the scheme for this LDAP URL.

Parameters:
scheme - The scheme for this LDAP URL.

getHost

public java.lang.String getHost()
Retrieves the host for this LDAP URL.

Returns:
The host for this LDAP URL, or null if none was provided.

setHost

public void setHost(java.lang.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 java.lang.String getRawBaseDN()
Retrieve the raw, unprocessed base DN for this LDAP URL.

Returns:
The raw, unprocessed base DN for this LDAP URL, or null if none was given (in which case a default of the null DN "" should be assumed).

setRawBaseDN

public void setRawBaseDN(java.lang.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 java.util.LinkedHashSet<java.lang.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 null if 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 java.lang.String getRawFilter()
Retrieves the raw, unprocessed search filter for this LDAP URL.

Returns:
The raw, unprocessed search filter for this LDAP URL, or null if none was given (in which case a default filter of "(objectClass=*)" should be assumed).

setRawFilter

public void setRawFilter(java.lang.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 java.util.LinkedList<java.lang.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:
true if the provided entry does match the criteria specified in this LDAP URL, or false if it does not.
Throws:
DirectoryException - If a problem occurs while attempting to make the determination.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this LDAP URL.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the object is equal to this LDAP URL, or false if not.

hashCode

public int hashCode()
Retrieves the hash code for this LDAP URL.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this LDAP URL.

toString

public java.lang.String toString()
Retrieves a string representation of this LDAP URL.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this LDAP URL.

toString

public void toString(java.lang.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.