|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.ExtendedRequest
com.unboundid.ldap.sdk.extensions.CancelExtendedRequest
@NotMutable @ThreadSafety(level=NOT_THREADSAFE) public final class CancelExtendedRequest
This class provides an implementation of the LDAP cancel extended request as
defined in RFC 3909. It
may be used to request that the server interrupt processing on another
operation in progress on the same connection. It behaves much like the
abandon operation, with the exception that both the cancel request and the
operation that is canceled will receive responses, whereas an abandon request
never returns a response, and the operation that is abandoned will also not
receive a response if the abandon is successful.
Modification mod = new Modification(ModificationType.REPLACE,
"description", "This is the new description.");
ModifyRequest modifyRequest =
new ModifyRequest("dc=example,dc=com", mod);
AsyncRequestID asyncRequestID =
connection.asyncModify(modifyRequest, myAsyncResultListener);
// Assume that we've waited a reasonable amount of time but the modify
// hasn't completed yet so we'll try to cancel it.
CancelExtendedRequest cancelRequest =
new CancelExtendedRequest(asyncRequestID);
// NOTE: The processExtendedOperation method will only throw an exception
// if a problem occurs while trying to send the request or read the
// response. It will not throw an exception because of a non-success
// response. That's good for us in this case because the cancel result
// should never be "SUCCESS".
ExtendedResult cancelResult =
connection.processExtendedOperation(cancelRequest);
switch (cancelResult.getResultCode())
{
case ResultCode.CANCELED:
System.out.println("The operation was successfully canceled.");
break;
case ResultCode.NO_SUCH_OPERATION:
System.out.println("The server didn't know anything about the " +
"operation. Maybe it's already completed.");
break;
case ResultCode.TOO_LATE:
System.out.println("It was too late in the operation processing " +
"to cancel the operation.");
break;
case ResultCode.CANNOT_CANCEL:
System.out.println("The target operation is not one that could be " +
"canceled.");
break;
default:
System.err.println("An error occurred while processing the cancel " +
"request.");
break;
}
| Field Summary | |
|---|---|
static java.lang.String |
CANCEL_REQUEST_OID
The OID (1.3.6.1.1.8) for the cancel extended request. |
| Fields inherited from class com.unboundid.ldap.sdk.ExtendedRequest |
|---|
TYPE_EXTENDED_REQUEST_OID, TYPE_EXTENDED_REQUEST_VALUE |
| Constructor Summary | |
|---|---|
CancelExtendedRequest(AsyncRequestID requestID)
Creates a new cancel extended request that will cancel the request with the specified async request ID. |
|
CancelExtendedRequest(AsyncRequestID requestID,
Control[] controls)
Creates a new cancel extended request that will cancel the request with the specified request ID. |
|
CancelExtendedRequest(ExtendedRequest extendedRequest)
Creates a new cancel extended request from the provided generic extended request. |
|
CancelExtendedRequest(int targetMessageID)
Creates a new cancel extended request that will cancel the request with the specified message ID. |
|
CancelExtendedRequest(int targetMessageID,
Control[] controls)
Creates a new cancel extended request that will cancel the request with the specified message ID. |
|
| Method Summary | |
|---|---|
CancelExtendedRequest |
duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request. |
CancelExtendedRequest |
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without impacting this request. |
java.lang.String |
getExtendedRequestName()
Retrieves the user-friendly name for the extended request, if available. |
int |
getTargetMessageID()
Retrieves the message ID of the request to cancel. |
protected ExtendedResult |
process(LDAPConnection connection,
int depth)
Sends this extended request to the directory server over the provided connection and returns the associated response. |
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer. |
| Methods inherited from class com.unboundid.ldap.sdk.ExtendedRequest |
|---|
encodeProtocolOp, getLastMessageID, getOID, getOperationType, getProtocolOpType, getValue, hasValue, responseReceived, writeTo |
| Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest |
|---|
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setResponseTimeoutMillis, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CANCEL_REQUEST_OID
| Constructor Detail |
|---|
public CancelExtendedRequest(AsyncRequestID requestID)
requestID - The async request ID of the request to cancel. It must
not be null.public CancelExtendedRequest(int targetMessageID)
targetMessageID - The message ID of the request to cancel.
public CancelExtendedRequest(AsyncRequestID requestID,
Control[] controls)
requestID - The async request ID of the request to cancel. It must
not be null.controls - The set of controls to include in the request.
public CancelExtendedRequest(int targetMessageID,
Control[] controls)
targetMessageID - The message ID of the request to cancel.controls - The set of controls to include in the request.
public CancelExtendedRequest(ExtendedRequest extendedRequest)
throws LDAPException
extendedRequest - The generic extended request to use to create this
cancel extended request.
LDAPException - If a problem occurs while decoding the request.| Method Detail |
|---|
protected ExtendedResult process(LDAPConnection connection,
int depth)
throws LDAPException
process in class ExtendedRequestconnection - The connection to use to communicate with the directory
server.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 sending the request or
reading the response.public int getTargetMessageID()
public CancelExtendedRequest duplicate()
duplicate in interface ReadOnlyLDAPRequestduplicate in class ExtendedRequestpublic CancelExtendedRequest duplicate(Control[] controls)
duplicate in interface ReadOnlyLDAPRequestduplicate in class ExtendedRequestcontrols - The set of controls to include in the duplicate request.
public java.lang.String getExtendedRequestName()
getExtendedRequestName in class ExtendedRequestpublic void toString(java.lang.StringBuilder buffer)
toString in interface ProtocolOptoString in interface ReadOnlyLDAPRequesttoString in class ExtendedRequestbuffer - The buffer to which to append a string representation of
this request.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||