com.unboundid.ldap.sdk
Class UpdatableLDAPRequest

java.lang.Object
  extended by com.unboundid.ldap.sdk.LDAPRequest
      extended by com.unboundid.ldap.sdk.UpdatableLDAPRequest
All Implemented Interfaces:
ReadOnlyLDAPRequest, java.io.Serializable
Direct Known Subclasses:
AddRequest, CompareRequest, DeleteRequest, ModifyDNRequest, ModifyRequest, SearchRequest

@NotExtensible
@ThreadSafety(level=NOT_THREADSAFE)
public abstract class UpdatableLDAPRequest
extends LDAPRequest

This class is the superclass of all types of LDAP requests that can be altered. It provides methods for updating the set of controls to include as part of the request and for 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.

See Also:
Serialized Form

Constructor Summary
protected UpdatableLDAPRequest(Control[] controls)
          Creates a new LDAP request with the provided set of controls.
 
Method Summary
 void addControl(Control control)
          Adds the provided control to the set of controls for this request.
 void addControls(Control... controls)
          Adds the provided controls to the set of controls for this request.
 void clearControls()
          Removes all controls from this request.
 boolean removeControl(Control control)
          Removes the provided control from the set of controls for this request.
 Control removeControl(java.lang.String oid)
          Removes the control with the specified OID from the set of controls for this request.
 Control replaceControl(Control control)
          Replaces the control with the same OID as the provided control with the provided control.
 Control replaceControl(java.lang.String oid, Control control)
          Replaces the control with the specified OID with the provided control.
 void setControls(Control... controls)
          Specifies the set of controls for this request.
 void setControls(java.util.List<Control> controls)
          Specifies the set of controls for this request.
 
Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getLastMessageID, getOperationType, getResponseTimeoutMillis, hasControl, hasControl, process, setFollowReferrals, setIntermediateResponseListener, setResponseTimeoutMillis, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.unboundid.ldap.sdk.ReadOnlyLDAPRequest
duplicate, duplicate, toCode
 

Constructor Detail

UpdatableLDAPRequest

protected UpdatableLDAPRequest(Control[] controls)
Creates a new LDAP request with the provided set of controls.

Parameters:
controls - The set of controls to include in this LDAP request.
Method Detail

setControls

public final void setControls(Control... controls)
Specifies the set of controls for this request.

Parameters:
controls - The set of controls for this request.

setControls

public final void setControls(java.util.List<Control> controls)
Specifies the set of controls for this request.

Parameters:
controls - The set of controls for this request.

clearControls

public final void clearControls()
Removes all controls from this request.


addControl

public final void addControl(Control control)
Adds the provided control to the set of controls for this request.

Parameters:
control - The control to add to the set of controls for this request. It must not be null.

addControls

public final void addControls(Control... controls)
Adds the provided controls to the set of controls for this request.

Parameters:
controls - The controls to add to the set of controls for this request.

removeControl

public final Control removeControl(java.lang.String oid)
Removes the control with the specified OID from the set of controls for this request. If this request has multiple controls with the same OID, then only the first will be removed.

Parameters:
oid - The OID of the control to remove. It must not be null.
Returns:
The control that was removed, or null if this request does not have any control with the specified OID.

removeControl

public final boolean removeControl(Control control)
Removes the provided control from the set of controls for this request. This will have no impact if the provided control is not included in the set of controls for this request.

Parameters:
control - The control to remove from the set of controls for this request. It must not be null.
Returns:
true if the control was found and removed, or false if not.

replaceControl

public final Control replaceControl(Control control)
Replaces the control with the same OID as the provided control with the provided control. If no control with the same OID exists in the request, then the control will be added to the request. If the request has multiple controls with the same OID as the new control, then only the first will be replaced.

Parameters:
control - The control to use in place of the existing control with the same OID. It must not be null.
Returns:
The control that was replaced, or null if there was no control with the same OID as the provided control.

replaceControl

public final Control replaceControl(java.lang.String oid,
                                    Control control)
Replaces the control with the specified OID with the provided control. If no control with the given OID exists in the request, then a new control will be added. If this request has multiple controls with the specified OID, then only the first will be replaced.

Parameters:
oid - The OID of the control to replace with the provided control. It must not be null.
control - The control to use in place of the control with the specified OID. It may be null if the control should be removed. It may have a different OID than the OID of the control being replaced.
Returns:
The control that was replaced, or null if there was no control with the specified OID.