LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPSearchRequest

java.lang.Object
  extended bycom.novell.ldap.LDAPMessage
      extended bycom.novell.ldap.LDAPSearchRequest
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class LDAPSearchRequest
extends LDAPMessage

Represents an LDAP Search request.

See Also:
LDAPConnection.sendRequest(com.novell.ldap.LDAPMessage, com.novell.ldap.LDAPMessageQueue), Serialized Form

Field Summary
static int AND
          Search Filter Identifier for an AND component.
static int ANY
          Search Filter Identifier for an ANY component of a SUBSTRING.
static int APPROX_MATCH
          Search Filter Identifier for an APPROX_MATCH component.
static int EQUALITY_MATCH
          Search Filter Identifier for an EQUALITY_MATCH component.
static int EXTENSIBLE_MATCH
          Search Filter Identifier for an EXTENSIBLE_MATCH component.
static int FINAL
          Search Filter Identifier for a FINAL component of a SUBSTRING.
static int GREATER_OR_EQUAL
          Search Filter Identifier for a GREATER_OR_EQUAL component.
static int INITIAL
          Search Filter Identifier for an INITIAL component of a SUBSTRING.
static int LESS_OR_EQUAL
          Search Filter Identifier for a LESS_OR_EQUAL component.
static int NOT
          Search Filter Identifier for a NOT component.
static int OR
          Search Filter Identifier for an OR component.
static int PRESENT
          Search Filter Identifier for a PRESENT component.
static int SUBSTRINGS
          Search Filter Identifier for a SUBSTRINGS component.
 
Fields inherited from class com.novell.ldap.LDAPMessage
ABANDON_REQUEST, ADD_REQUEST, ADD_RESPONSE, BIND_REQUEST, BIND_RESPONSE, COMPARE_REQUEST, COMPARE_RESPONSE, DEL_REQUEST, DEL_RESPONSE, EXTENDED_REQUEST, EXTENDED_RESPONSE, INTERMEDIATE_RESPONSE, message, MODIFY_RDN_REQUEST, MODIFY_RDN_RESPONSE, MODIFY_REQUEST, MODIFY_RESPONSE, SEARCH_REQUEST, SEARCH_RESPONSE, SEARCH_RESULT, SEARCH_RESULT_REFERENCE, UNBIND_REQUEST
 
Constructor Summary
LDAPSearchRequest()
          This constructor was added to support default Serialization
LDAPSearchRequest(java.lang.String base, int scope, com.novell.ldap.rfc2251.RfcFilter filter, java.lang.String[] attrs, int dereference, int maxResults, int serverTimeLimit, boolean typesOnly, LDAPControl[] cont)
          Constructs an LDAP Search Request with a filter in ASN1 format.
LDAPSearchRequest(java.lang.String base, int scope, java.lang.String filter, java.lang.String[] attrs, int dereference, int maxResults, int serverTimeLimit, boolean typesOnly, LDAPControl[] cont)
          Constructs an LDAP Search Request.
 
Method Summary
 java.lang.String[] getAttributes()
          Retrieves an array of attribute names to request for in a search.
 int getDereference()
          Retrieves the behaviour of dereferencing aliases on a search request.
 java.lang.String getDN()
          Retrieves the Base DN for a search request.
 int getMaxResults()
          Retrieves the maximum number of entries to be returned on a search.
 int getScope()
          Retrieves the scope of a search request.
 java.util.Iterator getSearchFilter()
          Retrieves an Iterator object representing the parsed filter for this search request.
 int getServerTimeLimit()
          Retrieves the server time limit for a search request.
 java.lang.String getStringFilter()
          Creates a string representation of the filter in this search request.
 boolean isTypesOnly()
          Retrieves whether attribute values or only attribute types(names) should be returned in a search request.
protected  void setDeserializedValues(LDAPMessage readObject, com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
           
 
Methods inherited from class com.novell.ldap.LDAPMessage
getControls, getMessageID, getTag, getType, isRequest, readDSML, readExternal, setTag, toString, writeDSML, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AND

public static final int AND
Search Filter Identifier for an AND component.

See Also:
Constant Field Values

OR

public static final int OR
Search Filter Identifier for an OR component.

See Also:
Constant Field Values

NOT

public static final int NOT
Search Filter Identifier for a NOT component.

See Also:
Constant Field Values

EQUALITY_MATCH

public static final int EQUALITY_MATCH
Search Filter Identifier for an EQUALITY_MATCH component.

See Also:
Constant Field Values

SUBSTRINGS

public static final int SUBSTRINGS
Search Filter Identifier for a SUBSTRINGS component.

See Also:
Constant Field Values

GREATER_OR_EQUAL

public static final int GREATER_OR_EQUAL
Search Filter Identifier for a GREATER_OR_EQUAL component.

See Also:
Constant Field Values

LESS_OR_EQUAL

public static final int LESS_OR_EQUAL
Search Filter Identifier for a LESS_OR_EQUAL component.

See Also:
Constant Field Values

PRESENT

public static final int PRESENT
Search Filter Identifier for a PRESENT component.

See Also:
Constant Field Values

APPROX_MATCH

public static final int APPROX_MATCH
Search Filter Identifier for an APPROX_MATCH component.

See Also:
Constant Field Values

EXTENSIBLE_MATCH

public static final int EXTENSIBLE_MATCH
Search Filter Identifier for an EXTENSIBLE_MATCH component.

See Also:
Constant Field Values

INITIAL

public static final int INITIAL
Search Filter Identifier for an INITIAL component of a SUBSTRING. Note: An initial SUBSTRING is represented as "*".

See Also:
Constant Field Values

ANY

public static final int ANY
Search Filter Identifier for an ANY component of a SUBSTRING. Note: An ANY SUBSTRING is represented as "**".

See Also:
Constant Field Values

FINAL

public static final int FINAL
Search Filter Identifier for a FINAL component of a SUBSTRING. Note: A FINAL SUBSTRING is represented as "*".

See Also:
Constant Field Values
Constructor Detail

LDAPSearchRequest

public LDAPSearchRequest()
This constructor was added to support default Serialization


LDAPSearchRequest

public LDAPSearchRequest(java.lang.String base,
                         int scope,
                         java.lang.String filter,
                         java.lang.String[] attrs,
                         int dereference,
                         int maxResults,
                         int serverTimeLimit,
                         boolean typesOnly,
                         LDAPControl[] cont)
                  throws LDAPException
Constructs an LDAP Search Request.

Parameters:
base - The base distinguished name to search from.

scope - The scope of the entries to search. The following are the valid options:

filter - The search filter specifying the search criteria.

attrs - The names of attributes to retrieve. operation exceeds the time limit.

dereference - Specifies when aliases should be dereferenced. Must be one of the constants defined in LDAPConstraints, which are DEREF_NEVER, DEREF_FINDING, DEREF_SEARCHING, or DEREF_ALWAYS.

maxResults - The maximum number of search results to return for a search request. The search operation will be terminated by the server with an LDAPException.SIZE_LIMIT_EXCEEDED if the number of results exceed the maximum.

serverTimeLimit - The maximum time in seconds that the server should spend returning search results. This is a server-enforced limit. A value of 0 means no time limit.

typesOnly - If true, returns the names but not the values of the attributes found. If false, returns the names and values for attributes found.

cont - Any controls that apply to the search request. or null if none.
See Also:
LDAPConnection.search(java.lang.String, int, java.lang.String, java.lang.String[], boolean), LDAPSearchConstraints

LDAPSearchRequest

public LDAPSearchRequest(java.lang.String base,
                         int scope,
                         com.novell.ldap.rfc2251.RfcFilter filter,
                         java.lang.String[] attrs,
                         int dereference,
                         int maxResults,
                         int serverTimeLimit,
                         boolean typesOnly,
                         LDAPControl[] cont)
Constructs an LDAP Search Request with a filter in ASN1 format.

Parameters:
base - The base distinguished name to search from.

scope - The scope of the entries to search. The following are the valid options:

filter - The search filter specifying the search criteria.

attrs - The names of attributes to retrieve. operation exceeds the time limit.

dereference - Specifies when aliases should be dereferenced. Must be either one of the constants defined in LDAPConstraints, which are DEREF_NEVER, DEREF_FINDING, DEREF_SEARCHING, or DEREF_ALWAYS.

maxResults - The maximum number of search results to return for a search request. The search operation will be terminated by the server with an LDAPException.SIZE_LIMIT_EXCEEDED if the number of results exceed the maximum.

serverTimeLimit - The maximum time in seconds that the server should spend returning search results. This is a server-enforced limit. A value of 0 means no time limit.

typesOnly - If true, returns the names but not the values of the attributes found. If false, returns the names and values for attributes found.

cont - Any controls that apply to the search request. or null if none.
See Also:
LDAPConnection.search(java.lang.String, int, java.lang.String, java.lang.String[], boolean), LDAPSearchConstraints
Method Detail

getDN

public java.lang.String getDN()
Retrieves the Base DN for a search request.

Returns:
the base DN for a search request

getScope

public int getScope()
Retrieves the scope of a search request.

Returns:
scope of a search request
See Also:
LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_ONE, * @see com.novell.ldap.LDAPConnection#SCOPE_SUBORDINATESUBTREE

getDereference

public int getDereference()
Retrieves the behaviour of dereferencing aliases on a search request.

Returns:
integer representing how to dereference aliases
See Also:
LDAPSearchConstraints.DEREF_ALWAYS, LDAPSearchConstraints.DEREF_FINDING, LDAPSearchConstraints.DEREF_NEVER, LDAPSearchConstraints.DEREF_SEARCHING

getMaxResults

public int getMaxResults()
Retrieves the maximum number of entries to be returned on a search.

Returns:
Maximum number of search entries.

getServerTimeLimit

public int getServerTimeLimit()
Retrieves the server time limit for a search request.

Returns:
server time limit in nanoseconds.

isTypesOnly

public boolean isTypesOnly()
Retrieves whether attribute values or only attribute types(names) should be returned in a search request.

Returns:
true if only attribute types (names) are returned, false if attributes types and values are to be returned.

getAttributes

public java.lang.String[] getAttributes()
Retrieves an array of attribute names to request for in a search.

Returns:
Attribute names to be searched

getStringFilter

public java.lang.String getStringFilter()
Creates a string representation of the filter in this search request.

Returns:
filter string for this search request

getSearchFilter

public java.util.Iterator getSearchFilter()
Retrieves an Iterator object representing the parsed filter for this search request.

The first object returned from the Iterator is an Integer indicating the type of filter component. One or more values follow the component type as subsequent items in the Iterator. The pattern of Integer component type followed by values continues until the end of the filter.

Values returned as a byte array may represent UTF-8 characters or may be binary values. The possible Integer components of a search filter and the associated values that follow are:

Returns:
Iterator representing filter components

setDeserializedValues

protected void setDeserializedValues(LDAPMessage readObject,
                                     com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Overrides:
setDeserializedValues in class LDAPMessage
Throws:
java.io.IOException
java.lang.ClassNotFoundException

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000