Package com.isode.dsapi
Class DirectorySession.PendingOperation
java.lang.Object
com.isode.dsapi.DirectorySession.PendingOperation
- Enclosing class:
- DirectorySession
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PendingOperation
(DirectorySession ds, int opID, DN dn, String operation) Construct a new PendingOperation object.protected
PendingOperation
(DirectorySession ds, int opID, String operation) Construct a new PendingOperation object.protected
PendingOperation
(DirectorySession ds, DN dn, String operation, IndicationException dsapiException) Construct a new PendingOperation object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancel an outstanding asynchronous operation.Return the DirectorySession for which this PendingObject was created.getDN()
Return the DN (if any) associated with this operation.Return the operation name that is associated with this operation.int
getOpID()
Return the operation ID associated with this operation.poll()
Check for completion of an asynchronous operation.toString()
Return a user friendly String representation of this object.
-
Constructor Details
-
PendingOperation
Construct a new PendingOperation object. This method is used by routines in the DirectorySession class.- Parameters:
ds
- the DirectorySession associated with this PendingObjectopID
- the operation ID, as returned from the JNI layerdn
- the DN of the entry relating to this operation (ornull
if none is applicable)operation
- a String containing the name of the operation (for UI purposes).
-
PendingOperation
protected PendingOperation(DirectorySession ds, DN dn, String operation, IndicationException dsapiException) Construct a new PendingOperation object. This method is used by routines in the DirectorySession class.This constructor is used when an attempt to initiate an asynchronous operation is bound to fail with some kind of IndicationException, but that exception should not be reported unless and until the caller polls to see the result of the operation.
- Parameters:
ds
- the DirectorySession associated with this PendingObject.dn
- the DN of the entry relating to this operation (ornull
if none is applicable)operation
- a String containing the name of the operation (for UI purposes).dsapiException
- a IndicationException which is to be reported when the caller polls this PendingOperation.- Since:
- 14.6
-
PendingOperation
Construct a new PendingOperation object. This method is used by routines in the DirectorySession class.- Parameters:
ds
- the DirectorySession associated with this PendingObjectopID
- the operation ID, as returned from the JNI layeroperation
- a String containing the name of the operation (for UI purposes)
-
-
Method Details
-
toString
Return a user friendly String representation of this object. -
getOpID
public int getOpID()Return the operation ID associated with this operation.- Returns:
- the operation ID, as used by the native DSAPI layer
-
getDN
Return the DN (if any) associated with this operation.- Returns:
- the DN associated with this operation, or
null
if no DN is associated with it
-
getOperation
Return the operation name that is associated with this operation.- Returns:
- the description (e.g. "asynchronous read") of this operation
-
getDirectorySession
Return the DirectorySession for which this PendingObject was created.- Returns:
- a DirectorySession
-
poll
public Indication poll() throws NativeLibraryException, NullPointerException, NoSuchOperationException, IllegalArgumentException, DirectoryOperationFailedException, NoSuchEntryException, IndicationExceptionCheck for completion of an asynchronous operation. For an operation which has not yet completed,null
will be returned. For an operation which has completed, an Indication will be returned. Once an Indication has been returned, further calls to this method using the same PendingOperation object will result in aNoSuchOperationException
being thrown.- Returns:
- either an Indication containing the result of the completed
operation, or
null
if the operation has not yet completed. - Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native libraryNoSuchOperationException
- if this operation is no longer in progress. This could be because a previous call topoll()
has already returned an Indication, or becausecancel()
was calledDirectoryOperationFailedException
- if the operation was sent to the directory, and the directory returned an "operation failed" status with no extra indication or informationNoSuchEntryException
- if the operation failed with an error indicating that the relevant DN was not foundIndicationException
- if the underlying layer returned an Indication that represents a failure status from the DSANullPointerException
IllegalArgumentException
-
cancel
public void cancel()Cancel an outstanding asynchronous operation. This is a way to indicate that the results of the operation are no longer of interest. Calling this method does not guarantee that the directory operation will be aborted.- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library
-