@Extensible @ThreadSafety(level=NOT_THREADSAFE) public abstract class LDAPRequest extends java.lang.Object implements ReadOnlyLDAPRequest
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.
ExtendedRequest
and SASLBindRequest
subclasses are actually
intended to be extended by third-party code.Modifier | Constructor and Description |
---|---|
protected |
LDAPRequest(Control[] controls)
Creates a new LDAP request with the provided set of controls.
|
Modifier and Type | Method and Description |
---|---|
boolean |
followReferrals(LDAPConnection connection)
Indicates whether to automatically follow any referrals encountered while
processing this request.
|
Control |
getControl(java.lang.String oid)
Retrieves the control with the specified OID from this request.
|
java.util.List<Control> |
getControlList()
Retrieves a list containing the set of controls for this request.
|
Control[] |
getControls()
Retrieves the set of controls for this request.
|
IntermediateResponseListener |
getIntermediateResponseListener()
Retrieves the intermediate response listener for this request, if any.
|
abstract int |
getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request.
|
abstract OperationType |
getOperationType()
Retrieves the type of operation that is represented by this request.
|
ReferralConnector |
getReferralConnector(LDAPConnection connection)
Retrieves the referral connector that should be used when establishing a
connection for the purpose of automatically following a referral.
|
protected ReferralConnector |
getReferralConnectorInternal()
Retrieves the referral connector that has been set for this request.
|
protected int |
getReferralDepth()
Retrieves the current depth to use when following referrals.
|
long |
getResponseTimeoutMillis(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.
|
boolean |
hasControl()
Indicates whether this request contains at least one control.
|
boolean |
hasControl(java.lang.String oid)
Indicates whether this request contains at least one control with the
specified OID.
|
protected abstract LDAPResult |
process(LDAPConnection connection,
int depth)
Processes this operation using the provided connection and returns the
result.
|
void |
setFollowReferrals(java.lang.Boolean followReferrals)
Specifies whether to automatically follow any referrals encountered while
processing this request.
|
void |
setIntermediateResponseListener(IntermediateResponseListener listener)
Sets the intermediate response listener for this request.
|
void |
setReferralConnector(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 void |
setReferralDepth(int referralDepth)
Sets the current depth to use when following referrals.
|
void |
setResponseTimeoutMillis(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.
|
java.lang.String |
toString()
Retrieves a string representation of this request.
|
abstract void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
duplicate, duplicate, toCode
protected LDAPRequest(@Nullable Control[] controls)
controls
- The set of controls to include in this LDAP request.@NotNull public final Control[] getControls()
getControls
in interface ReadOnlyLDAPRequest
@NotNull public final java.util.List<Control> getControlList()
getControlList
in interface ReadOnlyLDAPRequest
public final boolean hasControl()
hasControl
in interface ReadOnlyLDAPRequest
true
if this request contains at least one control, or
false
if not.public final boolean hasControl(@NotNull java.lang.String oid)
hasControl
in interface ReadOnlyLDAPRequest
oid
- The object identifier for which to make the determination. It
must not be null
.true
if this request contains at least one control with
the specified OID, or false
if not.@Nullable public final Control getControl(@NotNull java.lang.String oid)
getControl
in interface ReadOnlyLDAPRequest
oid
- The object identifier for which to retrieve the corresponding
control. It must not be null
.null
if
no control with that OID is included in this request.public final long getResponseTimeoutMillis(@Nullable LDAPConnection connection)
getResponseTimeoutMillis
in interface ReadOnlyLDAPRequest
connection
- The connection to use in order to retrieve the default
value, if appropriate. It may be null
to
retrieve the request-specific timeout (which may be
negative if no response-specific timeout has been set).public final void setResponseTimeoutMillis(long responseTimeout)
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.public final boolean followReferrals(@NotNull LDAPConnection connection)
followReferrals
in interface ReadOnlyLDAPRequest
connection
- The connection whose connection options may be used in
the course of making the determination. It must not
be null
.true
if any referrals encountered during processing should
be automatically followed, or false
if not.public final void setFollowReferrals(@Nullable java.lang.Boolean followReferrals)
followReferrals
- Indicates whether to automatically follow any
referrals encountered while processing this
request. It may be null
to indicate that
the determination should be based on the
connection options for the connection used to
process the request.protected int getReferralDepth()
protected void setReferralDepth(int referralDepth)
referralDepth
- The current depth to use when following referrals.@NotNull public final ReferralConnector getReferralConnector(@NotNull LDAPConnection connection)
getReferralConnector
in interface ReadOnlyLDAPRequest
connection
- The connection that may be used in the course of
obtaining the appropriate referral connector. It must
not be null
.null
.@Nullable protected final ReferralConnector getReferralConnectorInternal()
null
if no referral connector has been set for this
request and the connection's default referral connector will be
used if necessary.public final void setReferralConnector(@Nullable ReferralConnector referralConnector)
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 be
null
to use the default referral handler
for the connection on which the referral was
received.@Nullable public final IntermediateResponseListener getIntermediateResponseListener()
null
if there is none.public final void setIntermediateResponseListener(@Nullable IntermediateResponseListener listener)
listener
- The intermediate response listener for this request. It
may be null
to clear any existing listener.@InternalUseOnly @NotNull protected abstract LDAPResult process(@NotNull LDAPConnection connection, int depth) throws LDAPException
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.LDAPException
- If a problem occurs while processing the request.public abstract int getLastMessageID()
@NotNull public abstract OperationType getOperationType()
@NotNull public java.lang.String toString()
toString
in interface ReadOnlyLDAPRequest
toString
in class java.lang.Object
public abstract void toString(@NotNull java.lang.StringBuilder buffer)
toString
in interface ReadOnlyLDAPRequest
buffer
- The buffer to which to append a string representation of
this request.