Package org.forgerock.opendj.ldap.spi
Interface LDAPConnectionImpl
- All Superinterfaces:
AutoCloseable,Closeable
LDAP connection interface which implementations of
LDAPConnectionFactoryImpl should implement.-
Method Summary
Modifier and TypeMethodDescriptionabandonAsync(AbandonRequest request) Abandons the unfinished operation identified in the provided abandon request.addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously adds an entry to the Directory Server using the provided add request.voidRegisters the provided connection event listener so that it will be notified when this connection is closed by the application, receives an unsolicited notification, or experiences a fatal error.bindAsync(BindRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously authenticates to the Directory Server using the provided bind request.voidclose()Releases any resources associated with this connection.voidclose(UnbindRequest request, String reason) Releases any resources associated with this connection.compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously compares an entry in the Directory Server using the provided compare request.deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously deletes an entry from the Directory Server using the provided delete request.org.forgerock.util.promise.Promise<Void, LdapException> Installs the TLS/SSL security layer on the underlying connection.<R extends ExtendedResult>
LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously performs the provided extended request in the Directory Server.booleanisClosed()Indicates whether this connection has been explicitly closed by callingclose.booleanisValid()Returnstrueif this connection has not been closed and no fatal errors have been detected.modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously modifies an entry in the Directory Server using the provided modify request.modifyDNAsync(ModifyDNRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously renames an entry in the Directory Server using the provided modify DN request.voidRemoves the provided connection event listener from this connection so that it will no longer be notified when this connection is closed by the application, receives an unsolicited notification, or experiences a fatal error.searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler) Asynchronously searches the Directory Server using the provided search request.
-
Method Details
-
abandonAsync
Abandons the unfinished operation identified in the provided abandon request.- Parameters:
request- The request identifying the operation to be abandoned.- Returns:
- A promise whose result is Void.
- Throws:
UnsupportedOperationException- If this connection does not support abandon operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
addAsync
LdapPromise<Result> addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously adds an entry to the Directory Server using the provided add request.- Parameters:
request- The add request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support add operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
addConnectionEventListener
Registers the provided connection event listener so that it will be notified when this connection is closed by the application, receives an unsolicited notification, or experiences a fatal error.- Parameters:
listener- The listener which wants to be notified when events occur on this connection.- Throws:
IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- If thelistenerwasnull.- See Also:
-
bindAsync
LdapPromise<BindResult> bindAsync(BindRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously authenticates to the Directory Server using the provided bind request.- Parameters:
request- The bind request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support bind operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
close
void close()Releases any resources associated with this connection. Callingcloseon a connection that is already closed has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- See Also:
-
close
Releases any resources associated with this connection. Callingcloseon a connection that is already closed has no effect.- Parameters:
request- The unbind request to use in the case where a physical connection is closed.reason- A reason describing why the connection was closed.- Throws:
NullPointerException- Ifrequestwasnull.- See Also:
-
compareAsync
LdapPromise<CompareResult> compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously compares an entry in the Directory Server using the provided compare request.- Parameters:
request- The compare request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support compare operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
deleteAsync
LdapPromise<Result> deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously deletes an entry from the Directory Server using the provided delete request.- Parameters:
request- The delete request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support delete operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
enableTLS
org.forgerock.util.promise.Promise<Void,LdapException> enableTLS(SSLContext sslContext, List<String> protocols, List<String> suites) Installs the TLS/SSL security layer on the underlying connection. The TLS/SSL security layer will be installed beneath any existing connection security layers and can only be installed at most once.- Parameters:
sslContext- TheSSLContextwhich should be used to secure theprotocols- Names of all the protocols to enable ornullto use the default protocols.suites- Names of all the suites to enable ornullto use the default cipher suites.- Returns:
- A promise which will complete once the SSL handshake has completed.
- Throws:
IllegalStateException- If the TLS/SSL security layer has already been installed.
-
extendedRequestAsync
<R extends ExtendedResult> LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously performs the provided extended request in the Directory Server.- Type Parameters:
R- The type of result returned by the extended request.- Parameters:
request- The extended request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support extended operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
isClosed
boolean isClosed()Indicates whether this connection has been explicitly closed by callingclose. This method will not returntrueif a fatal error has occurred on the connection unlessclosehas been called.- Returns:
trueif this connection has been explicitly closed by callingclose, orfalseotherwise.- See Also:
-
isValid
boolean isValid()Returnstrueif this connection has not been closed and no fatal errors have been detected. This method is guaranteed to returnfalseonly when it is called after the methodclosehas been called.- Returns:
trueif this connection is valid,falseotherwise.- See Also:
-
modifyAsync
LdapPromise<Result> modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously modifies an entry in the Directory Server using the provided modify request.- Parameters:
request- The modify request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support modify operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
modifyDNAsync
LdapPromise<Result> modifyDNAsync(ModifyDNRequest request, IntermediateResponseHandler intermediateResponseHandler) Asynchronously renames an entry in the Directory Server using the provided modify DN request.- Parameters:
request- The modify DN request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support modify DN operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-
removeConnectionEventListener
Removes the provided connection event listener from this connection so that it will no longer be notified when this connection is closed by the application, receives an unsolicited notification, or experiences a fatal error.- Parameters:
listener- The listener which no longer wants to be notified when events occur on this connection.- Throws:
NullPointerException- If thelistenerwasnull.- See Also:
-
searchAsync
LdapPromise<Result> searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler) Asynchronously searches the Directory Server using the provided search request.- Parameters:
request- The search request.intermediateResponseHandler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.entryHandler- A search result handler which can be used to asynchronously process the search result entries and references as they are received, may benull.- Returns:
- A promise representing the result of the operation.
- Throws:
UnsupportedOperationException- If this connection does not support search operations.IllegalStateException- If this connection has already been closed, i.e. ifisClosed() == true.NullPointerException- Ifrequestwasnull.- See Also:
-