Class LDAPSearchConstraints
- All Implemented Interfaces:
Serializable,Cloneable
LDAPSearchConstraints object,
specifying your preferences, and passing the object to
the LDAPConnection.search method.
- Version:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate intprivate intstatic final intContinue processing if there is an error following a search continuation referencestatic final intThrow exception if there is an error following a search continuation referenceprivate intprivate intFields inherited from class netscape.ldap.LDAPConstraints
serialVersionUID -
Constructor Summary
ConstructorsConstructorDescriptionConstructs anLDAPSearchConstraintsobject that specifies the default set of search constraints.LDAPSearchConstraints(int msLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPRebind rebind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object.LDAPSearchConstraints(int msLimit, int timeLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPBind bind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object.LDAPSearchConstraints(int msLimit, int timeLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPRebind rebind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object. -
Method Summary
Modifier and TypeMethodDescriptionclone()Makes a copy of an existing set of search constraints.intReturns the suggested number of results to return at a time during search.intSpecifies how aliases should be dereferenced.intDeprecated.intReturns the maximum number of search results that are to be returned; 0 means there is no limit.intReports if errors when following search continuation references are to cause processing of the remaining results to be aborted.intReturns the maximum number of seconds to wait for the server to spend on a search operation.If 0, there is no time limit.voidsetBatchSize(int batchSize) Sets the suggested number of results to return at a time during search.voidsetDereference(int dereference) Sets a preference indicating how aliases should be dereferenced.voidsetMaxBacklog(int backlog) Deprecated.UseLDAPConnection.setOption()voidsetMaxResults(int maxResults) Sets the maximum number of search results to return; 0 means there is no limit.voidsetReferralErrors(int errorBehavior) Specifies if errors when following search continuation references are to cause processing of the remaining results to be aborted.voidsetServerTimeLimit(int limit) Sets the maximum number of seconds for the server to spend returning search results.toString()Return a string representation of the object for debuggingMethods inherited from class netscape.ldap.LDAPConstraints
getBindProc, getClientControls, getHopLimit, getRebindProc, getReferrals, getServerControls, getTimeLimit, setBindProc, setClientControls, setClientControls, setHopLimit, setRebindProc, setReferrals, setServerControls, setServerControls, setTimeLimit
-
Field Details
-
REFERRAL_ERROR_CONTINUE
public static final int REFERRAL_ERROR_CONTINUEContinue processing if there is an error following a search continuation reference- See Also:
-
REFERRAL_ERROR_EXCEPTION
public static final int REFERRAL_ERROR_EXCEPTIONThrow exception if there is an error following a search continuation reference- See Also:
-
deref
private int deref -
maxRes
private int maxRes -
batch
private int batch -
serverTimeLimit
private int serverTimeLimit -
maxBacklog
private int maxBacklog -
referralErrors
private int referralErrors
-
-
Constructor Details
-
LDAPSearchConstraints
public LDAPSearchConstraints()Constructs anLDAPSearchConstraintsobject that specifies the default set of search constraints. -
LDAPSearchConstraints
public LDAPSearchConstraints(int msLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPRebind rebind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object.- Parameters:
msLimit- maximum time in milliseconds to wait for results (0 by default, which means that there is no maximum time limit)dereference- eitherLDAPv2.DEREF_NEVER,LDAPv2.DEREF_FINDING,LDAPv2.DEREF_SEARCHING, orLDAPv2.DEREF_ALWAYS(see LDAPConnection.setOption).LDAPv2.DEREF_NEVERis the default.maxResults- maximum number of search results to return (1000 by default)doReferrals- specifytrueto follow referrals automatically, orfalseto throw anLDAPReferralExceptionerror if the server sends back a referral (falseby default)batchSize- specify the number of results to return at a time (1 by default)rebind_proc- specifies the object of the class that implements theLDAPRebindinterface (you need to define this class). The object will be used when the client follows referrals automatically. The object provides the client with a method for getting the distinguished name and password used to authenticate to another LDAP server during a referral. (This field isnullby default.)hop_limit- maximum number of referrals to follow in a sequence when attempting to resolve a request- See Also:
-
LDAPSearchConstraints
public LDAPSearchConstraints(int msLimit, int timeLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPRebind rebind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object.- Parameters:
msLimit- maximum time in milliseconds to wait for results (0 by default, which means that there is no maximum time limit)timeLimit- maximum time in seconds for the server to spend processing a search request (the default value is 0, indicating that there is no limit)dereference- eitherLDAPv2.DEREF_NEVER,LDAPv2.DEREF_FINDING,LDAPv2.DEREF_SEARCHING, orLDAPv2.DEREF_ALWAYS(see LDAPConnection.setOption).LDAPv2.DEREF_NEVERis the default.maxResults- maximum number of search results to return (1000 by default)doReferrals- specifytrueto follow referrals automatically, orfalseto throw anLDAPReferralExceptionerror if the server sends back a referral (falseby default)batchSize- specify the number of results to return at a time (1 by default)rebind_proc- specifies the object that implements theLDAPRebindinterface. The object will be used when the client follows referrals automatically. The object provides the client with a method for getting the distinguished name and password used to authenticate to another LDAP server during a referral. (This field isnullby default.)hop_limit- maximum number of referrals to follow in a sequence when attempting to resolve a request- See Also:
-
LDAPSearchConstraints
public LDAPSearchConstraints(int msLimit, int timeLimit, int dereference, int maxResults, boolean doReferrals, int batchSize, LDAPBind bind_proc, int hop_limit) Constructs a newLDAPSearchConstraintsobject and allows you to specify the search constraints in that object.- Parameters:
msLimit- maximum time in milliseconds to wait for results (0 by default, which means that there is no maximum time limit)timeLimit- maximum time in seconds for the server to spend processing a search request (the default value is 0, indicating that there is no limit)dereference- eitherLDAPv2.DEREF_NEVER,LDAPv2.DEREF_FINDING,LDAPv2.DEREF_SEARCHING, orLDAPv2.DEREF_ALWAYS(see LDAPConnection.setOption).LDAPv2.DEREF_NEVERis the default.maxResults- maximum number of search results to return (1000 by default)doReferrals- specifytrueto follow referrals automatically, orfalseto throw anLDAPReferralExceptionerror if the server sends back a referral (falseby default)batchSize- specify the number of results to return at a time (1 by default)bind_proc- specifies the object that implements theLDAPBindinterface (you need to define this class). The object will be used to authenticate to the server on referrals. (This field isnullby default.)hop_limit- maximum number of referrals to follow in a sequence when attempting to resolve a request- See Also:
-
-
Method Details
-
getServerTimeLimit
public int getServerTimeLimit()Returns the maximum number of seconds to wait for the server to spend on a search operation.If 0, there is no time limit.- Returns:
- maximum number of seconds for the server to spend.
-
getDereference
public int getDereference()Specifies how aliases should be dereferenced.- Returns:
LDAPv2.DEREF_NEVERto never follow ("dereference") aliases,LDAPv2.DEREF_FINDINGto dereference when finding the starting point for the search (but not when searching under that starting entry),LDAPv2.DEREF_SEARCHINGto dereference when searching the entries beneath the starting point of the search (but not when finding the starting entry), orLDAPv2.DEREF_ALWAYSto always dereference aliases.
-
getMaxResults
public int getMaxResults()Returns the maximum number of search results that are to be returned; 0 means there is no limit.- Returns:
- maximum number of search results to be returned.
-
getBatchSize
public int getBatchSize()Returns the suggested number of results to return at a time during search. This should be 0 if intermediate results are not needed, and 1 if results are to be processed as they come in.- Returns:
- number of results to return at a time.
-
setServerTimeLimit
public void setServerTimeLimit(int limit) Sets the maximum number of seconds for the server to spend returning search results. If 0, there is no time limit.- Parameters:
limit- maximum number of seconds for the server to spend. (0 by default, which means that there is no maximum time limit.)
-
setDereference
public void setDereference(int dereference) Sets a preference indicating how aliases should be dereferenced.- Parameters:
dereference-LDAPv2.DEREF_NEVERto never follow ("dereference") aliases,LDAPv2.DEREF_FINDINGto dereference when finding the starting point for the search (but not when searching under that starting entry),LDAPv2.DEREF_SEARCHINGto dereference when searching the entries beneath the starting point of the search (but not when finding the starting entry), orLDAPv2.DEREF_ALWAYSto always dereference aliases
-
setMaxResults
public void setMaxResults(int maxResults) Sets the maximum number of search results to return; 0 means there is no limit. (By default, this is set to 1000.)- Parameters:
maxResults- maximum number of search results to return
-
setBatchSize
public void setBatchSize(int batchSize) Sets the suggested number of results to return at a time during search. This should be 0 if intermediate results are not needed, and 1 if results are to be processed as they come in. (By default, this is 1.)- Parameters:
batchSize- number of results to return at a time
-
setMaxBacklog
Deprecated.UseLDAPConnection.setOption()Set the maximum number of unread entries any search listener can have before we stop reading from the server.- Parameters:
backlog- the maximum number of unread entries per listener
-
getMaxBacklog
Deprecated.UseLDAPConnection.getOption()Get the maximum number of unread entries any search listener can have before we stop reading from the server.- Returns:
- the maximum number of unread entries per listener.
-
getReferralErrors
public int getReferralErrors()Reports if errors when following search continuation references are to cause processing of the remaining results to be aborted.If an LDAP server does not contain an entry at the base DN for a search, it may be configured to return a referral. If it contains an entry at the base DN of a subtree search, one or more of the child entries may contain search continuation references. The search continuation references are returned to the client, which may follow them by issuing a search request to the host indicated in the search reference.
If the
LDAPConnectionobject has been configured to follow referrals automatically, it may fail when issuing a search request to the host indicated in a search reference, e.g. because there is no entry there, because it does not have credentials, because it does not have sufficient permissions, etc. If the client aborts evaluation of the search results (obtained throughLDAPSearchResults) when a search reference cannot be followed, any remaining results are discarded.Up to version 4.17 of the Java LDAP SDK, the SDK printed an error message but continued to process the remaining search results and search continuation references.
As of SDK version 4.17, the default behavior is still to continue processing any remaining search results and search continuation references if there is an error following a referral, but the behavior may be changed with
setReferralErrorsto throw an exception instead.- Returns:
REFERRAL_ERROR_CONTINUEif remaining results are to be processed when there is an error following a search continuation reference,REFERRAL_ERROR_EXCEPTIONif such an error is to cause anLDAPException.- Since:
- LDAPJDK 4.17
- See Also:
-
setReferralErrors
public void setReferralErrors(int errorBehavior) Specifies if errors when following search continuation references are to cause processing of the remaining results to be aborted.If an LDAP server does not contain an entry at the base DN for a search, it may be configured to return a referral. If it contains an entry at the base DN of a subtree search, one or more of the child entries may contain search continuation references. The search continuation references are returned to the client, which may follow them by issuing a search request to the host indicated in the search reference.
If the
LDAPConnectionobject has been configured to follow referrals automatically, it may fail when issuing a search request to the host indicated in a search reference, e.g. because there is no entry there, because it does not have credentials, because it does not have sufficient permissions, etc. If the client aborts evaluation of the search results (obtained throughLDAPSearchResults) when a search reference cannot be followed, any remaining results are discarded.Up to version 4.17 of the Java LDAP SDK, the SDK printed an error message but continued to process the remaining search results and search continuation references.
As of SDK version 4.17, the default behavior is still to continue processing any remaining search results and search continuation references if there is an error following a referral, but the behavior may be changed with
setReferralErrorsto throw an exception instead.- Parameters:
errorBehavior- EitherREFERRAL_ERROR_CONTINUEif remaining results are to be processed when there is an error following a search continuation reference orREFERRAL_ERROR_EXCEPTIONif such an error is to cause anLDAPException.- Since:
- LDAPJDK 4.17
- See Also:
-
clone
Makes a copy of an existing set of search constraints.- Overrides:
clonein classLDAPConstraints- Returns:
- a copy of an existing set of search constraints.
-
toString
Return a string representation of the object for debugging- Overrides:
toStringin classLDAPConstraints- Returns:
- A string representation of the object
-
LDAPConnection.getOption()