Class AbstractConnectionWrapper<C extends Connection>
- java.lang.Object
-
- org.forgerock.opendj.ldap.AbstractConnectionWrapper<C>
-
- Type Parameters:
C- The type of wrapped connection.
- All Implemented Interfaces:
Closeable,AutoCloseable,Connection
public abstract class AbstractConnectionWrapper<C extends Connection> extends Object implements Connection
An abstract base class from which connection wrappers may be easily implemented. The default implementation of each method is to delegate to the wrapped connection.
-
-
Field Summary
Fields Modifier and Type Field Description protected CconnectionThe wrapped connection.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConnectionWrapper(C connection)Creates a new connection wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LdapPromise<Void>abandonAsync(AbandonRequest request)Abandons the unfinished operation identified in the provided abandon request.Resultadd(String... ldifLines)Adds an entry to the Directory Server using the provided lines of LDIF.Resultadd(Entry entry)Adds the provided entry to the Directory Server.Resultadd(AddRequest request)Adds an entry to the Directory Server using the provided add request.LdapPromise<Result>addAsync(AddRequest request)Asynchronously adds an entry to the Directory Server using the provided add request.LdapPromise<Result>addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously adds an entry to the Directory Server using the provided add request.voidaddConnectionEventListener(ConnectionEventListener listener)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.ResultapplyChange(ChangeRecord request)Applies the provided change request to the Directory Server.LdapPromise<Result>applyChangeAsync(ChangeRecord request)Asynchronously applies the provided change request to the Directory Server.LdapPromise<Result>applyChangeAsync(ChangeRecord request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously applies the provided change request to the Directory Server.BindResultbind(String name, char[] password)Authenticates to the Directory Server using simple authentication and the provided user name and password.BindResultbind(BindRequest request)Authenticates to the Directory Server using the provided bind request.LdapPromise<BindResult>bindAsync(BindRequest request)Asynchronously authenticates to the Directory Server using the provided bind request.LdapPromise<BindResult>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.CompareResultcompare(String name, String attributeDescription, String assertionValue)Compares the named entry in the Directory Server against the provided attribute value assertion.CompareResultcompare(CompareRequest request)Compares an entry in the Directory Server using the provided compare request.LdapPromise<CompareResult>compareAsync(CompareRequest request)Asynchronously compares an entry in the Directory Server using the provided compare request.LdapPromise<CompareResult>compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously compares an entry in the Directory Server using the provided compare request.Resultdelete(String name)Deletes the named entry from the Directory Server.Resultdelete(DeleteRequest request)Deletes an entry from the Directory Server using the provided delete request.LdapPromise<Result>deleteAsync(DeleteRequest request)Asynchronously deletes an entry from the Directory Server using the provided delete request.LdapPromise<Result>deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously deletes an entry from the Directory Server using the provided delete request.ResultdeleteSubtree(String name)Deletes the named entry and all of its subordinates from the Directory Server.GenericExtendedResultextendedRequest(String requestName, ByteString requestValue)Requests that the Directory Server performs the provided extended request.<R extends ExtendedResult>
RextendedRequest(ExtendedRequest<R> request)Requests that the Directory Server performs the provided extended request.<R extends ExtendedResult>
RextendedRequest(ExtendedRequest<R> request, IntermediateResponseHandler handler)Requests that the Directory Server performs the provided extended request, optionally listening for any intermediate responses.<R extends ExtendedResult>
LdapPromise<R>extendedRequestAsync(ExtendedRequest<R> request)Asynchronously performs the provided extended request in the Directory Server.<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.Resultmodify(String... ldifLines)Modifies an entry in the Directory Server using the provided lines of LDIF.Resultmodify(ModifyRequest request)Modifies an entry in the Directory Server using the provided modify request.LdapPromise<Result>modifyAsync(ModifyRequest request)Asynchronously modifies an entry in the Directory Server using the provided modify request.LdapPromise<Result>modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously modifies an entry in the Directory Server using the provided modify request.ResultmodifyDn(String name, String newRDN)Renames the named entry in the Directory Server using the provided new RDN.ResultmodifyDn(ModifyDnRequest request)Renames an entry in the Directory Server using the provided modify DN request.LdapPromise<Result>modifyDnAsync(ModifyDnRequest request)Asynchronously renames an entry in the Directory Server using the provided modify DN request.LdapPromise<Result>modifyDnAsync(ModifyDnRequest request, IntermediateResponseHandler intermediateResponseHandler)Asynchronously renames an entry in the Directory Server using the provided modify DN request.SearchResultEntryreadEntry(String name, String... attributeDescriptions)Reads the named entry from the Directory Server.SearchResultEntryreadEntry(Dn name, String... attributeDescriptions)Reads the named entry from the Directory Server.LdapPromise<SearchResultEntry>readEntryAsync(Dn name, Collection<String> attributeDescriptions)Asynchronously reads the named entry from the Directory Server.voidremoveConnectionEventListener(ConnectionEventListener listener)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.ConnectionEntryReadersearch(String baseObject, SearchScope scope, String filter, String... attributeDescriptions)Searches the Directory Server using the provided search parameters.ConnectionEntryReadersearch(SearchRequest request)Searches the Directory Server using the provided search parameters.Resultsearch(SearchRequest request, Collection<? super SearchResultEntry> entries)Searches the Directory Server using the provided search request.Resultsearch(SearchRequest request, Collection<? super SearchResultEntry> entries, Collection<? super SearchResultReference> references)Searches the Directory Server using the provided search request.Resultsearch(SearchRequest request, SearchResultHandler handler)Searches the Directory Server using the provided search request.LdapPromise<Result>searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler)Asynchronously searches the Directory Server using the provided search request.LdapPromise<Result>searchAsync(SearchRequest request, SearchResultHandler resultHandler)Asynchronously searches the Directory Server using the provided search request.SearchResultEntrysearchSingleEntry(String baseObject, SearchScope scope, String filter, String... attributeDescriptions)Searches the Directory Server for a single entry using the provided search parameters.SearchResultEntrysearchSingleEntry(SearchRequest request)Searches the Directory Server for a single entry using the provided search request.LdapPromise<SearchResultEntry>searchSingleEntryAsync(SearchRequest request)Asynchronously searches the Directory Server for a single entry using the provided search request.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.forgerock.opendj.ldap.Connection
delete
-
-
-
-
Field Detail
-
connection
protected final C extends Connection connection
The wrapped connection.
-
-
Constructor Detail
-
AbstractConnectionWrapper
protected AbstractConnectionWrapper(C connection)
Creates a new connection wrapper.- Parameters:
connection- The connection to be wrapped.
-
-
Method Detail
-
abandonAsync
public LdapPromise<Void> abandonAsync(AbandonRequest request)
Abandons the unfinished operation identified in the provided abandon request.Abandon requests do not have a response, so invoking the method get() on the returned promise will not block, nor return anything (it is Void), but may throw an exception if a problem occurred while sending the abandon request. In addition the returned promise may be used in order to determine the message ID of the abandon request.
Note: a more convenient approach to abandoning unfinished asynchronous operations is provided via the
Promise.cancel(boolean)method.The default implementation is to delegate.
- Specified by:
abandonAsyncin interfaceConnection- Parameters:
request- The request identifying the operation to be abandoned.- Returns:
- A promise whose result is Void.
-
add
public Result add(AddRequest request) throws LdapException
Adds an entry to the Directory Server using the provided add request.The default implementation is to delegate.
- Specified by:
addin interfaceConnection- Parameters:
request- The add request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
add
public Result add(Entry entry) throws LdapException
Adds the provided entry to the Directory Server.This method is equivalent to the following code:
AddRequest request = new AddRequest(entry); connection.add(request);
The default implementation is to delegate.
- Specified by:
addin interfaceConnection- Parameters:
entry- The entry to be added.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
add
public Result add(String... ldifLines) throws LdapException
Adds an entry to the Directory Server using the provided lines of LDIF.This method is equivalent to the following code:
AddRequest request = new AddRequest(ldifLines); connection.add(request);
The default implementation is to delegate.
- Specified by:
addin interfaceConnection- Parameters:
ldifLines- Lines of LDIF containing the an LDIF add change record or an LDIF entry record.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
addAsync
public LdapPromise<Result> addAsync(AddRequest request)
Asynchronously adds an entry to the Directory Server using the provided add request.The default implementation is to delegate.
- Specified by:
addAsyncin interfaceConnection- Parameters:
request- The add request.- Returns:
- A promise representing the result of the operation.
-
addAsync
public LdapPromise<Result> addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously adds an entry to the Directory Server using the provided add request.The default implementation is to delegate.
- Specified by:
addAsyncin interfaceConnection- 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.
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)
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.The default implementation is to delegate.
- Specified by:
addConnectionEventListenerin interfaceConnection- Parameters:
listener- The listener which wants to be notified when events occur on this connection.
-
applyChange
public Result applyChange(ChangeRecord request) throws LdapException
Applies the provided change request to the Directory Server.The default implementation is to delegate.
- Specified by:
applyChangein interfaceConnection- Parameters:
request- The change request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
applyChangeAsync
public LdapPromise<Result> applyChangeAsync(ChangeRecord request)
Asynchronously applies the provided change request to the Directory Server.The default implementation is to delegate.
- Specified by:
applyChangeAsyncin interfaceConnection- Parameters:
request- The change request.- Returns:
- A promise representing the result of the operation.
-
applyChangeAsync
public LdapPromise<Result> applyChangeAsync(ChangeRecord request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously applies the provided change request to the Directory Server.The default implementation is to delegate.
- Specified by:
applyChangeAsyncin interfaceConnection- Parameters:
request- The change 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.
-
bind
public BindResult bind(BindRequest request) throws LdapException
Authenticates to the Directory Server using the provided bind request.The default implementation is to delegate.
- Specified by:
bindin interfaceConnection- Parameters:
request- The bind request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
bind
public BindResult bind(String name, char[] password) throws LdapException
Authenticates to the Directory Server using simple authentication and the provided user name and password.This method is equivalent to the following code:
BindRequest request = new SimpleBindRequest(name, password); connection.bind(request);
The default implementation is to delegate.
- Specified by:
bindin interfaceConnection- Parameters:
name- The distinguished name of the Directory object that the client wishes to bind as, which may be empty.password- The password of the Directory object that the client wishes to bind as, which may be empty.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
bindAsync
public LdapPromise<BindResult> bindAsync(BindRequest request)
Asynchronously authenticates to the Directory Server using the provided bind request.The default implementation is to delegate.
- Specified by:
bindAsyncin interfaceConnection- Parameters:
request- The bind request.- Returns:
- A promise representing the result of the operation.
-
bindAsync
public LdapPromise<BindResult> bindAsync(BindRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously authenticates to the Directory Server using the provided bind request.The default implementation is to delegate.
- Specified by:
bindAsyncin interfaceConnection- 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.
-
close
public void close()
Releases any resources associated with this connection. For physical connections to a Directory Server this will mean that an unbind request is sent and the underlying socket is closed.Other connection implementations may behave differently, and may choose not to send an unbind request if its use is inappropriate (for example a pooled connection will be released and returned to its connection pool without ever issuing an unbind request).
This method is equivalent to the following code:
UnbindRequest request = new UnbindRequest(); connection.close(request);
Callingcloseon a connection that is already closed has no effect.The default implementation is to delegate.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- See Also:
Connections.uncloseable(Connection)
-
close
public void close(UnbindRequest request, String reason)
Releases any resources associated with this connection. For physical connections to a Directory Server this will mean that the provided unbind request is sent and the underlying socket is closed.Other connection implementations may behave differently, and may choose to ignore the provided unbind request if its use is inappropriate (for example a pooled connection will be released and returned to its connection pool without ever issuing an unbind request).
Calling
closeon a connection that is already closed has no effect.The default implementation is to delegate.
- Specified by:
closein interfaceConnection- 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.
-
compare
public CompareResult compare(CompareRequest request) throws LdapException
Compares an entry in the Directory Server using the provided compare request.The default implementation is to delegate.
- Specified by:
comparein interfaceConnection- Parameters:
request- The compare request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
compare
public CompareResult compare(String name, String attributeDescription, String assertionValue) throws LdapException
Compares the named entry in the Directory Server against the provided attribute value assertion.This method is equivalent to the following code:
CompareRequest request = new CompareRequest(name, attributeDescription, assertionValue); connection.compare(request);
The default implementation is to delegate.
- Specified by:
comparein interfaceConnection- Parameters:
name- The distinguished name of the entry to be compared.attributeDescription- The name of the attribute to be compared.assertionValue- The assertion value to be compared.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
compareAsync
public LdapPromise<CompareResult> compareAsync(CompareRequest request)
Asynchronously compares an entry in the Directory Server using the provided compare request.The default implementation is to delegate.
- Specified by:
compareAsyncin interfaceConnection- Parameters:
request- The compare request.- Returns:
- A promise representing the result of the operation.
-
compareAsync
public LdapPromise<CompareResult> compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously compares an entry in the Directory Server using the provided compare request.The default implementation is to delegate.
- Specified by:
compareAsyncin interfaceConnection- 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.
-
delete
public Result delete(DeleteRequest request) throws LdapException
Deletes an entry from the Directory Server using the provided delete request.The default implementation is to delegate.
- Specified by:
deletein interfaceConnection- Parameters:
request- The delete request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
delete
public Result delete(String name) throws LdapException
Deletes the named entry from the Directory Server.This method is equivalent to the following code:
DeleteRequest request = new DeleteRequest(name); connection.delete(request);
The default implementation is to delegate.
- Specified by:
deletein interfaceConnection- Parameters:
name- The distinguished name of the entry to be deleted.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
deleteAsync
public LdapPromise<Result> deleteAsync(DeleteRequest request)
Asynchronously deletes an entry from the Directory Server using the provided delete request.The default implementation is to delegate.
- Specified by:
deleteAsyncin interfaceConnection- Parameters:
request- The delete request.- Returns:
- A promise representing the result of the operation.
-
deleteAsync
public LdapPromise<Result> deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously deletes an entry from the Directory Server using the provided delete request.The default implementation is to delegate.
- Specified by:
deleteAsyncin interfaceConnection- 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.
-
deleteSubtree
public Result deleteSubtree(String name) throws LdapException
Deletes the named entry and all of its subordinates from the Directory Server.This method is equivalent to the following code:
DeleteRequest request = new DeleteRequest(name).addControl( connection.delete(request);
The default implementation is to delegate.
- Specified by:
deleteSubtreein interfaceConnection- Parameters:
name- The distinguished name of the subtree base entry to be deleted.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
extendedRequest
public <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request) throws LdapException
Requests that the Directory Server performs the provided extended request.The default implementation is to delegate.
- Specified by:
extendedRequestin interfaceConnection- Type Parameters:
R- The type of result returned by the extended request.- Parameters:
request- The extended request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
extendedRequest
public <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request, IntermediateResponseHandler handler) throws LdapException
Requests that the Directory Server performs the provided extended request, optionally listening for any intermediate responses.The default implementation is to delegate.
- Specified by:
extendedRequestin interfaceConnection- Type Parameters:
R- The type of result returned by the extended request.- Parameters:
request- The extended request.handler- An intermediate response handler which can be used to process any intermediate responses as they are received, may benull.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
extendedRequest
public GenericExtendedResult extendedRequest(String requestName, ByteString requestValue) throws LdapException
Requests that the Directory Server performs the provided extended request.This method is equivalent to the following code:
GenericExtendedRequest request = new GenericExtendedRequest(requestName, requestValue); connection.extendedRequest(request);
The default implementation is to delegate.
- Specified by:
extendedRequestin interfaceConnection- Parameters:
requestName- The dotted-decimal representation of the unique OID corresponding to the extended request.requestValue- The content of the extended request in a form defined by the extended operation, ornullif there is no content.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
extendedRequestAsync
public <R extends ExtendedResult> LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request)
Asynchronously performs the provided extended request in the Directory Server.The default implementation is to delegate.
- Specified by:
extendedRequestAsyncin interfaceConnection- Type Parameters:
R- The type of result returned by the extended request.- Parameters:
request- The extended request.- Returns:
- A promise representing the result of the operation.
-
extendedRequestAsync
public <R extends ExtendedResult> LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously performs the provided extended request in the Directory Server.The default implementation is to delegate.
- Specified by:
extendedRequestAsyncin interfaceConnection- 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.
-
isClosed
public 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.The default implementation is to delegate.
- Specified by:
isClosedin interfaceConnection- Returns:
trueif this connection has been explicitly closed by callingclose, orfalseotherwise.
-
isValid
public 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.The default implementation is to delegate.
- Specified by:
isValidin interfaceConnection- Returns:
trueif this connection is valid,falseotherwise.
-
modify
public Result modify(ModifyRequest request) throws LdapException
Modifies an entry in the Directory Server using the provided modify request.The default implementation is to delegate.
- Specified by:
modifyin interfaceConnection- Parameters:
request- The modify request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
modify
public Result modify(String... ldifLines) throws LdapException
Modifies an entry in the Directory Server using the provided lines of LDIF.This method is equivalent to the following code:
ModifyRequest request = new ModifyRequest(name, ldifChanges); connection.modify(request);
The default implementation is to delegate.
- Specified by:
modifyin interfaceConnection- Parameters:
ldifLines- Lines of LDIF containing the a single LDIF modify change record.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
modifyAsync
public LdapPromise<Result> modifyAsync(ModifyRequest request)
Asynchronously modifies an entry in the Directory Server using the provided modify request.The default implementation is to delegate.
- Specified by:
modifyAsyncin interfaceConnection- Parameters:
request- The modify request.- Returns:
- A promise representing the result of the operation.
-
modifyAsync
public LdapPromise<Result> modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously modifies an entry in the Directory Server using the provided modify request.The default implementation is to delegate.
- Specified by:
modifyAsyncin interfaceConnection- 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.
-
modifyDn
public Result modifyDn(ModifyDnRequest request) throws LdapException
Renames an entry in the Directory Server using the provided modify DN request.The default implementation is to delegate.
- Specified by:
modifyDnin interfaceConnection- Parameters:
request- The modify DN request.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
modifyDn
public Result modifyDn(String name, String newRDN) throws LdapException
Renames the named entry in the Directory Server using the provided new RDN.This method is equivalent to the following code:
ModifyDNRequest request = new ModifyDNRequest(name, newRDN); connection.modifyDN(request);
The default implementation is to delegate.
- Specified by:
modifyDnin interfaceConnection- Parameters:
name- The distinguished name of the entry to be renamed.newRDN- The new RDN of the entry.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
modifyDnAsync
public LdapPromise<Result> modifyDnAsync(ModifyDnRequest request)
Asynchronously renames an entry in the Directory Server using the provided modify DN request.The default implementation is to delegate.
- Specified by:
modifyDnAsyncin interfaceConnection- Parameters:
request- The modify DN request.- Returns:
- A promise representing the result of the operation.
-
modifyDnAsync
public LdapPromise<Result> modifyDnAsync(ModifyDnRequest request, IntermediateResponseHandler intermediateResponseHandler)
Asynchronously renames an entry in the Directory Server using the provided modify DN request.The default implementation is to delegate.
- Specified by:
modifyDnAsyncin interfaceConnection- 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.
-
readEntry
public SearchResultEntry readEntry(Dn name, String... attributeDescriptions) throws LdapException
Reads the named entry from the Directory Server.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, this method will never returnnull.This method is equivalent to the following code:
SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT, "(objectClass=*)", attributeDescriptions); connection.searchSingleEntry(request);
The default implementation is to delegate.
- Specified by:
readEntryin interfaceConnection- Parameters:
name- The distinguished name of the entry to be read.attributeDescriptions- The names of the attributes to be included with the entry, which may benullor empty indicating that all user attributes should be returned.- Returns:
- The single search result entry returned from the search.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
readEntry
public SearchResultEntry readEntry(String name, String... attributeDescriptions) throws LdapException
Reads the named entry from the Directory Server.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, this method will never returnnull.This method is equivalent to the following code:
SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT, "(objectClass=*)", attributeDescriptions); connection.searchSingleEntry(request);The default implementation is to delegate.
- Specified by:
readEntryin interfaceConnection- Parameters:
name- The distinguished name of the entry to be read.attributeDescriptions- The names of the attributes to be included with the entry.- Returns:
- The single search result entry returned from the search.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
readEntryAsync
public LdapPromise<SearchResultEntry> readEntryAsync(Dn name, Collection<String> attributeDescriptions)
Asynchronously reads the named entry from the Directory Server.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, the returned promise will never returnnull.This method is equivalent to the following code:
SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT, "(objectClass=*)", attributeDescriptions); connection.searchSingleEntryAsync(request, resultHandler, p);The default implementation is to delegate.
- Specified by:
readEntryAsyncin interfaceConnection- Parameters:
name- The distinguished name of the entry to be read.attributeDescriptions- The names of the attributes to be included with the entry, which may benullor empty indicating that all user attributes should be returned.- Returns:
- A promise representing the result of the operation.
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)
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.The default implementation is to delegate.
- Specified by:
removeConnectionEventListenerin interfaceConnection- Parameters:
listener- The listener which no longer wants to be notified when events occur on this connection.
-
search
public ConnectionEntryReader search(SearchRequest request)
Searches the Directory Server using the provided search parameters. Any matching entries returned by the search will be exposed through the returnedConnectionEntryReader.Unless otherwise specified, calling this method is equivalent to:
ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
The default implementation is to delegate.
- Specified by:
searchin interfaceConnection- Parameters:
request- The search request.- Returns:
- The result of the operation.
-
search
public Result search(SearchRequest request, Collection<? super SearchResultEntry> entries) throws LdapException
Searches the Directory Server using the provided search request. Any matching entries returned by the search will be added toentries, even if the final search result indicates that the search failed. Search result references will be discarded.Warning: Usage of this method is discouraged if the search request is expected to yield a large number of search results since the entire set of results will be stored in memory, potentially causing an
OutOfMemoryError.This method is equivalent to the following code:
connection.search(request, entries, null);
The default implementation is to delegate.
- Specified by:
searchin interfaceConnection- Parameters:
request- The search request.entries- The collection to which matching entries should be added.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
search
public Result search(SearchRequest request, Collection<? super SearchResultEntry> entries, Collection<? super SearchResultReference> references) throws LdapException
Searches the Directory Server using the provided search request. Any matching entries returned by the search will be added toentries, even if the final search result indicates that the search failed. Similarly, search result references returned by the search will be added toreferences.Warning: Usage of this method is discouraged if the search request is expected to yield a large number of search results since the entire set of results will be stored in memory, potentially causing an
OutOfMemoryError.The default implementation is to delegate.
- Specified by:
searchin interfaceConnection- Parameters:
request- The search request.entries- The collection to which matching entries should be added.references- The collection to which search result references should be added, ornullif references are to be discarded.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
search
public Result search(SearchRequest request, SearchResultHandler handler) throws LdapException
Searches the Directory Server using the provided search request. Any matching entries returned by the search as well as any search result references will be passed to the provided search result handler.The default implementation is to delegate.
- Specified by:
searchin interfaceConnection- Parameters:
request- The search request.handler- A search result handler which can be used to process the search result entries and references as they are received, may benull.- Returns:
- The result of the operation.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
search
public ConnectionEntryReader search(String baseObject, SearchScope scope, String filter, String... attributeDescriptions)
Searches the Directory Server using the provided search parameters. Any matching entries returned by the search will be exposed through theEntryReaderinterface.Warning: When using a queue with an optional capacity bound, the connection will stop reading responses and wait if necessary for space to become available.
This method is equivalent to the following code:
SearchRequest request = new SearchRequest(baseDN, scope, filter, attributeDescriptions); connection.search(request, new LinkedBlockingQueue<Response>());
The default implementation is to delegate.
- Specified by:
searchin interfaceConnection- Parameters:
baseObject- The distinguished name of the base entry relative to which the search is to be performed.scope- The scope of the search.filter- The filter that defines the conditions that must be fulfilled in order for an entry to be returned.attributeDescriptions- The names of the attributes to be included with each entry.- Returns:
- An entry reader exposing the returned entries.
-
searchAsync
public LdapPromise<Result> searchAsync(SearchRequest request, SearchResultHandler resultHandler)
Asynchronously searches the Directory Server using the provided search request.The default implementation is to delegate.
- Specified by:
searchAsyncin interfaceConnection- Parameters:
request- The search request.resultHandler- 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.
-
searchAsync
public LdapPromise<Result> searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler)
Asynchronously searches the Directory Server using the provided search request.The default implementation is to delegate.
- Specified by:
searchAsyncin interfaceConnection- 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.
-
searchSingleEntry
public SearchResultEntry searchSingleEntry(SearchRequest request) throws LdapException
Searches the Directory Server for a single entry using the provided search request.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, this method will never returnnull. If multiple matching entries are returned by the Directory Server then the request will fail with anMultipleEntriesFoundException.The default implementation is to delegate.
- Specified by:
searchSingleEntryin interfaceConnection- Parameters:
request- The search request.- Returns:
- The single search result entry returned from the search.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
searchSingleEntry
public SearchResultEntry searchSingleEntry(String baseObject, SearchScope scope, String filter, String... attributeDescriptions) throws LdapException
Searches the Directory Server for a single entry using the provided search parameters.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, this method will never returnnull. If multiple matching entries are returned by the Directory Server then the request will fail with anMultipleEntriesFoundException.This method is equivalent to the following code:
SearchRequest request = new SearchRequest(baseObject, scope, filter, attributeDescriptions); connection.searchSingleEntry(request);
The default implementation is to delegate.
- Specified by:
searchSingleEntryin interfaceConnection- Parameters:
baseObject- The distinguished name of the base entry relative to which the search is to be performed.scope- The scope of the search.filter- The filter that defines the conditions that must be fulfilled in order for an entry to be returned.attributeDescriptions- The names of the attributes to be included with each entry.- Returns:
- The single search result entry returned from the search.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.
-
searchSingleEntryAsync
public LdapPromise<SearchResultEntry> searchSingleEntryAsync(SearchRequest request)
Asynchronously searches the Directory Server for a single entry using the provided search request.If the requested entry is not returned by the Directory Server then the request will fail with an
EntryNotFoundException. More specifically, the returned promise will never returnnull. If multiple matching entries are returned by the Directory Server then the request will fail with anMultipleEntriesFoundException.The default implementation is to delegate.
- Specified by:
searchSingleEntryAsyncin interfaceConnection- Parameters:
request- The search request.- Returns:
- A promise representing the result of the operation.
-
-