Package com.unboundid.ldap.sdk
Class LDAPRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
- Direct Known Subclasses:
BindRequest,ExtendedRequest,UpdatableLDAPRequest
@Extensible
@ThreadSafety(level=NOT_THREADSAFE)
public abstract class LDAPRequest
extends Object
implements ReadOnlyLDAPRequest
This class provides a framework that should be extended by all types of LDAP
requests. It provides methods for interacting with the set of controls to
include as part of the request and configuring a response timeout, which is
the maximum length of time that the SDK should wait for a response to the
request before returning an error back to the caller.
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
LDAPRequest objects are not immutable and should not be considered
threadsafe. A single LDAPRequest object instance should not be used
concurrently by multiple threads, but instead each thread wishing to process
a request should have its own instance of that request. The
ReadOnlyLDAPRequest.duplicate() method may be used to create an exact copy of a request
suitable for processing by a separate thread.
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
ExtendedRequest and SASLBindRequest subclasses are actually
intended to be extended by third-party code.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLDAPRequest(Control[] controls) Creates a new LDAP request with the provided set of controls. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfollowReferrals(LDAPConnection connection) Indicates whether to automatically follow any referrals encountered while processing this request.final ControlgetControl(String oid) Retrieves the control with the specified OID from this request.Retrieves a list containing the set of controls for this request.final Control[]Retrieves the set of controls for this request.Retrieves the intermediate response listener for this request, if any.abstract intRetrieves the message ID for the last LDAP message sent using this request.abstract OperationTypeRetrieves the type of operation that is represented by this request.final ReferralConnectorgetReferralConnector(LDAPConnection connection) Retrieves the referral connector that should be used when establishing a connection for the purpose of automatically following a referral.protected final ReferralConnectorRetrieves the referral connector that has been set for this request.protected intRetrieves the current depth to use when following referrals.final longgetResponseTimeoutMillis(LDAPConnection connection) Retrieves the maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server.final booleanIndicates whether this request contains at least one control.final booleanhasControl(String oid) Indicates whether this request contains at least one control with the specified OID.protected abstract LDAPResultprocess(LDAPConnection connection, int depth) Processes this operation using the provided connection and returns the result.final voidsetFollowReferrals(Boolean followReferrals) Specifies whether to automatically follow any referrals encountered while processing this request.final voidSets the intermediate response listener for this request.final voidsetReferralConnector(ReferralConnector referralConnector) Sets the referral connector that should be used to establish connections for the purpose of following any referrals encountered when processing this request.protected voidsetReferralDepth(int referralDepth) Sets the current depth to use when following referrals.final voidsetResponseTimeoutMillis(long responseTimeout) Specifies the maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server.toString()Retrieves a string representation of this request.abstract voidtoString(StringBuilder buffer) Appends a string representation of this request to the provided buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.unboundid.ldap.sdk.ReadOnlyLDAPRequest
duplicate, duplicate, toCode
-
Constructor Details
-
LDAPRequest
Creates a new LDAP request with the provided set of controls.- Parameters:
controls- The set of controls to include in this LDAP request.
-
-
Method Details
-
getControls
Retrieves the set of controls for this request. The caller must not alter this set of controls.- Specified by:
getControlsin interfaceReadOnlyLDAPRequest- Returns:
- The set of controls for this request.
-
getControlList
Retrieves a list containing the set of controls for this request.- Specified by:
getControlListin interfaceReadOnlyLDAPRequest- Returns:
- A list containing the set of controls for this request.
-
hasControl
Indicates whether this request contains at least one control.- Specified by:
hasControlin interfaceReadOnlyLDAPRequest- Returns:
trueif this request contains at least one control, orfalseif not.
-
hasControl
Indicates whether this request contains at least one control with the specified OID.- Specified by:
hasControlin interfaceReadOnlyLDAPRequest- Parameters:
oid- The object identifier for which to make the determination. It must not benull.- Returns:
trueif this request contains at least one control with the specified OID, orfalseif not.
-
getControl
Retrieves the control with the specified OID from this request. If this request has multiple controls with the specified OID, then the first will be returned.- Specified by:
getControlin interfaceReadOnlyLDAPRequest- Parameters:
oid- The object identifier for which to retrieve the corresponding control. It must not benull.- Returns:
- The first control found with the specified OID, or
nullif no control with that OID is included in this request.
-
getResponseTimeoutMillis
Retrieves the maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server.- Specified by:
getResponseTimeoutMillisin interfaceReadOnlyLDAPRequest- Parameters:
connection- The connection to use in order to retrieve the default value, if appropriate. It may benullto retrieve the request-specific timeout (which may be negative if no response-specific timeout has been set).- Returns:
- The maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server, or zero if no timeout should be enforced.
-
setResponseTimeoutMillis
Specifies the maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server. A value of zero indicates that no timeout should be enforced. A value that is less than zero indicates that the default response timeout for the underlying connection should be used.- Parameters:
responseTimeout- The maximum length of time in milliseconds that processing on this operation should be allowed to block while waiting for a response from the server.
-
followReferrals
Indicates whether to automatically follow any referrals encountered while processing this request. If a value has been set for this request, then it will be returned. Otherwise, the default from the connection options for the provided connection will be used.- Specified by:
followReferralsin interfaceReadOnlyLDAPRequest- Parameters:
connection- The connection whose connection options may be used in the course of making the determination. It must not benull.- Returns:
trueif any referrals encountered during processing should be automatically followed, orfalseif not.
-
setFollowReferrals
Specifies whether to automatically follow any referrals encountered while processing this request. This may be used to override the default behavior defined in the connection options for the connection used to process the request.- Parameters:
followReferrals- Indicates whether to automatically follow any referrals encountered while processing this request. It may benullto indicate that the determination should be based on the connection options for the connection used to process the request.
-
getReferralDepth
Retrieves the current depth to use when following referrals.- Returns:
- The current depth to use when following referrals.
-
setReferralDepth
Sets the current depth to use when following referrals.- Parameters:
referralDepth- The current depth to use when following referrals.
-
getReferralConnector
Retrieves the referral connector that should be used when establishing a connection for the purpose of automatically following a referral.- Specified by:
getReferralConnectorin interfaceReadOnlyLDAPRequest- Parameters:
connection- The connection that may be used in the course of obtaining the appropriate referral connector. It must not benull.- Returns:
- The referral connector that should be used for the purpose of
automatically following a referral. It will not be
null.
-
getReferralConnectorInternal
Retrieves the referral connector that has been set for this request.- Returns:
- The referral connector that has been set for this request, or
nullif no referral connector has been set for this request and the connection's default referral connector will be used if necessary.
-
setReferralConnector
Sets the referral connector that should be used to establish connections for the purpose of following any referrals encountered when processing this request.- Parameters:
referralConnector- The referral connector that should be used to establish connections for the purpose of following any referral encountered when processing this request. It may benullto use the default referral handler for the connection on which the referral was received.
-
getIntermediateResponseListener
Retrieves the intermediate response listener for this request, if any.- Returns:
- The intermediate response listener for this request, or
nullif there is none.
-
setIntermediateResponseListener
Sets the intermediate response listener for this request.- Parameters:
listener- The intermediate response listener for this request. It may benullto clear any existing listener.
-
process
@InternalUseOnly @NotNull protected abstract LDAPResult process(@NotNull LDAPConnection connection, int depth) throws LDAPException Processes this operation using the provided connection and returns the result.- Parameters:
connection- The connection to use to process the request.depth- The current referral depth for this request. It should always be one for the initial request, and should only be incremented when following referrals.- Returns:
- The result of processing this operation.
- Throws:
LDAPException- If a problem occurs while processing the request.
-
getLastMessageID
Retrieves the message ID for the last LDAP message sent using this request.- Returns:
- The message ID for the last LDAP message sent using this request, or -1 if it no LDAP messages have yet been sent using this request.
-
getOperationType
Retrieves the type of operation that is represented by this request.- Returns:
- The type of operation that is represented by this request.
-
toString
Retrieves a string representation of this request.- Specified by:
toStringin interfaceReadOnlyLDAPRequest- Overrides:
toStringin classObject- Returns:
- A string representation of this request.
-
toString
Appends a string representation of this request to the provided buffer.- Specified by:
toStringin interfaceReadOnlyLDAPRequest- Parameters:
buffer- The buffer to which to append a string representation of this request.
-