Package org.forgerock.opendj.ldap.spi
Class LdapPromises
java.lang.Object
org.forgerock.opendj.ldap.spi.LdapPromises
Utility methods for creating and composing
LdapPromises.-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> LdapPromise<R> asPromise(org.forgerock.util.promise.Promise<R, LdapException> wrappedPromise) Converts aPromiseto aLdapPromise.static BindResultLdapPromiseImplnewBindLdapPromise(int requestID, BindRequest request, BindClient bindClient, IntermediateResponseHandler intermediateResponseHandler) Creates a new bindBindResultLdapPromiseImpl.newCompareLdapPromise(int requestID, CompareRequest request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new compareResultLdapPromiseImpl.newCompareLdapPromise(int requestID, CompareRequest request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new compareResultLdapPromiseImpl.static <S extends ExtendedResult>
ExtendedResultLdapPromiseImpl<S> newExtendedLdapPromise(int requestID, ExtendedRequest<S> request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new extendedExtendedResultLdapPromiseImpl.static <S extends ExtendedResult>
ExtendedResultLdapPromiseImpl<S> newExtendedLdapPromise(int requestID, ExtendedRequest<S> request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new extendedExtendedResultLdapPromiseImpl.static <R,E extends LdapException>
LdapPromise<R> newFailedLdapPromise(E error) Returns aLdapPromiserepresenting an asynchronous task which has already failed with the provided error.static <R,E extends LdapException>
LdapPromise<R> newFailedLdapPromise(E error, int requestID) Returns aLdapPromiserepresenting an asynchronous task, identified by the provided requestID, which has already failed with the provided error.static <R extends Request>
ResultLdapPromiseImpl<R, Result> newResultLdapPromise(int requestID, R request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a newResultLdapPromiseImplto handle a standard request (add, delete, modify and modidyDN).static <R extends Request>
ResultLdapPromiseImpl<R, Result> newResultLdapPromise(int requestID, R request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a newResultLdapPromiseImplto handle a standard request (add, delete, modify and modidyDN).static SearchResultLdapPromiseImplnewSearchLdapPromise(int requestID, SearchRequest request, SearchResultHandler resultHandler, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new searchSearchResultLdapPromiseImpl.static SearchResultLdapPromiseImplnewSearchLdapPromise(int requestID, SearchRequest request, SearchResultHandler resultHandler, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new searchSearchResultLdapPromiseImpl.static <R> LdapPromise<R> newSuccessfulLdapPromise(R result) Returns aLdapPromiserepresenting an asynchronous task which has already succeeded with the provided result.static <R> LdapPromise<R> newSuccessfulLdapPromise(R result, int requestID) Returns aLdapPromiserepresenting an asynchronous task, identified by the provided requestID, which has already succeeded with the provided result.
-
Method Details
-
asPromise
public static <R> LdapPromise<R> asPromise(org.forgerock.util.promise.Promise<R, LdapException> wrappedPromise) Converts aPromiseto aLdapPromise.- Type Parameters:
R- The type of the task's result, orVoidif the task does not return anything (i.e. it only has side-effects).- Parameters:
wrappedPromise- ThePromiseto wrap.- Returns:
- A
LdapPromiserepresenting the same asynchronous task as thePromiseprovided.
-
newBindLdapPromise
public static BindResultLdapPromiseImpl newBindLdapPromise(int requestID, BindRequest request, BindClient bindClient, IntermediateResponseHandler intermediateResponseHandler) Creates a new bindBindResultLdapPromiseImpl.- Parameters:
requestID- Identifier of the request.request- The bind request sent to server.bindClient- Client that binds to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.- Returns:
- The new
BindResultLdapPromiseImpl.
-
newCompareLdapPromise
public static ResultLdapPromiseImpl<CompareRequest,CompareResult> newCompareLdapPromise(int requestID, CompareRequest request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new compareResultLdapPromiseImpl.- Parameters:
requestID- Identifier of the request.request- The compare request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ResultLdapPromiseImpl.
-
newCompareLdapPromise
public static ResultLdapPromiseImpl<CompareRequest,CompareResult> newCompareLdapPromise(int requestID, CompareRequest request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new compareResultLdapPromiseImpl.- Parameters:
requestID- Identifier of the request.request- The compare request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ResultLdapPromiseImpl.
-
newExtendedLdapPromise
public static <S extends ExtendedResult> ExtendedResultLdapPromiseImpl<S> newExtendedLdapPromise(int requestID, ExtendedRequest<S> request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new extendedExtendedResultLdapPromiseImpl.- Type Parameters:
S- The type of result returned by this promise.- Parameters:
requestID- Identifier of the request.request- The extended request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ExtendedResultLdapPromiseImpl.
-
newExtendedLdapPromise
public static <S extends ExtendedResult> ExtendedResultLdapPromiseImpl<S> newExtendedLdapPromise(int requestID, ExtendedRequest<S> request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new extendedExtendedResultLdapPromiseImpl.- Type Parameters:
S- The type of result returned by this promise.- Parameters:
requestID- Identifier of the request.request- The extended request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ExtendedResultLdapPromiseImpl.
-
newResultLdapPromise
public static <R extends Request> ResultLdapPromiseImpl<R,Result> newResultLdapPromise(int requestID, R request, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a newResultLdapPromiseImplto handle a standard request (add, delete, modify and modidyDN).- Type Parameters:
R- The type of the task's request.- Parameters:
requestID- Identifier of the request.request- The request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ResultLdapPromiseImpl.
-
newResultLdapPromise
public static <R extends Request> ResultLdapPromiseImpl<R,Result> newResultLdapPromise(int requestID, R request, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a newResultLdapPromiseImplto handle a standard request (add, delete, modify and modidyDN).- Type Parameters:
R- The type of the task's request.- Parameters:
requestID- Identifier of the request.request- The request sent to the server.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
ResultLdapPromiseImpl.
-
newSearchLdapPromise
public static SearchResultLdapPromiseImpl newSearchLdapPromise(int requestID, SearchRequest request, SearchResultHandler resultHandler, IntermediateResponseHandler intermediateResponseHandler, Connection connection) Creates a new searchSearchResultLdapPromiseImpl.- Parameters:
requestID- Identifier of the request.request- The search request sent to the server.resultHandler- Handler that consumes search result.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
SearchResultLdapPromiseImpl.
-
newSearchLdapPromise
public static SearchResultLdapPromiseImpl newSearchLdapPromise(int requestID, SearchRequest request, SearchResultHandler resultHandler, IntermediateResponseHandler intermediateResponseHandler, LDAPConnectionImpl connection) Creates a new searchSearchResultLdapPromiseImpl.- Parameters:
requestID- Identifier of the request.request- The search request sent to the server.resultHandler- Handler that consumes search result.intermediateResponseHandler- Handler that consumes intermediate responses from extended operations.connection- The connection to directory server.- Returns:
- The new
SearchResultLdapPromiseImpl.
-
newFailedLdapPromise
Returns aLdapPromiserepresenting an asynchronous task which has already failed with the provided error.- Type Parameters:
R- The type of the task's result, orVoidif the task does not return anything (i.e. it only has side-effects).E- The type of the exception thrown by the task if it fails.- Parameters:
error- The exception indicating why the asynchronous task has failed.- Returns:
- A
LdapPromiserepresenting an asynchronous task which has already failed with the provided error.
-
newFailedLdapPromise
public static <R,E extends LdapException> LdapPromise<R> newFailedLdapPromise(E error, int requestID) Returns aLdapPromiserepresenting an asynchronous task, identified by the provided requestID, which has already failed with the provided error.- Type Parameters:
R- The type of the task's result, orVoidif the task does not return anything (i.e. it only has side-effects).E- The type of the exception thrown by the task if it fails.- Parameters:
error- The exception indicating why the asynchronous task has failed.requestID- The request ID of the failed task.- Returns:
- A
LdapPromiserepresenting an asynchronous task which has already failed with the provided error.
-
newSuccessfulLdapPromise
Returns aLdapPromiserepresenting an asynchronous task which has already succeeded with the provided result. Attempts to get the result will immediately return the result.- Type Parameters:
R- The type of the task's result, orVoidif the task does not return anything (i.e. it only has side-effects).- Parameters:
result- The result of the asynchronous task.- Returns:
- A
LdapPromiserepresenting an asynchronous task which has already succeeded with the provided result.
-
newSuccessfulLdapPromise
Returns aLdapPromiserepresenting an asynchronous task, identified by the provided requestID, which has already succeeded with the provided result. Attempts to get the result will immediately return the result.- Type Parameters:
R- The type of the task's result, orVoidif the task does not return anything (i.e. it only has side-effects).- Parameters:
result- The result of the asynchronous task.requestID- The request ID of the succeeded task.- Returns:
- A
LdapPromiserepresenting an asynchronous task which has already succeeded with the provided result.
-