C
- The type of wrapped connection.public abstract class AbstractConnectionWrapper<C extends Connection> extends Object implements Connection
Modifier and Type | Field and Description |
---|---|
protected C |
connection
The wrapped connection.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractConnectionWrapper(C connection)
Creates a new connection wrapper.
|
Modifier and Type | Method and Description |
---|---|
LdapPromise<Void> |
abandonAsync(AbandonRequest request)
Abandons the unfinished operation identified in the provided abandon
request.
|
Result |
add(AddRequest request)
Adds an entry to the Directory Server using the provided add request.
|
Result |
add(Entry entry)
Adds the provided entry to the Directory Server.
|
Result |
add(String... ldifLines)
Adds an entry to the Directory Server using the provided lines of LDIF.
|
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.
|
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.
|
Result |
applyChange(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.
|
BindResult |
bind(BindRequest request)
Authenticates to the Directory Server using the provided bind request.
|
BindResult |
bind(String name,
char[] password)
Authenticates to the Directory Server using simple authentication and the
provided user name and password.
|
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.
|
void |
close()
Releases any resources associated with this connection.
|
void |
close(UnbindRequest request,
String reason)
Releases any resources associated with this connection.
|
CompareResult |
compare(CompareRequest request)
Compares an entry in the Directory Server using the provided compare
request.
|
CompareResult |
compare(String name,
String attributeDescription,
String assertionValue)
Compares the named entry in the Directory Server against the provided
attribute value assertion.
|
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.
|
Result |
delete(DeleteRequest request)
Deletes an entry from the Directory Server using the provided delete
request.
|
Result |
delete(String name)
Deletes the named entry from the Directory Server.
|
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.
|
Result |
deleteSubtree(String name)
Deletes the named entry and all of its subordinates from the Directory
Server.
|
<R extends ExtendedResult> |
extendedRequest(ExtendedRequest<R> request)
Requests that the Directory Server performs the provided extended
request.
|
<R extends ExtendedResult> |
extendedRequest(ExtendedRequest<R> request,
IntermediateResponseHandler handler)
Requests that the Directory Server performs the provided extended
request, optionally listening for any intermediate responses.
|
GenericExtendedResult |
extendedRequest(String requestName,
ByteString requestValue)
Requests that the Directory Server performs the provided extended
request.
|
<R extends ExtendedResult> |
extendedRequestAsync(ExtendedRequest<R> request)
Asynchronously performs the provided extended request in the Directory
Server.
|
<R extends ExtendedResult> |
extendedRequestAsync(ExtendedRequest<R> request,
IntermediateResponseHandler intermediateResponseHandler)
Asynchronously performs the provided extended request in the Directory
Server.
|
boolean |
isClosed()
Indicates whether this connection has been explicitly closed by
calling
close . |
boolean |
isValid()
Returns
true if this connection has not been closed and no fatal
errors have been detected. |
Result |
modify(ModifyRequest request)
Modifies an entry in the Directory Server using the provided modify
request.
|
Result |
modify(String... ldifLines)
Modifies an entry in the Directory Server using the provided lines of
LDIF.
|
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.
|
Result |
modifyDn(ModifyDnRequest request)
Renames an entry in the Directory Server using the provided modify DN
request.
|
Result |
modifyDn(String name,
String newRDN)
Renames the named entry in the Directory Server using the provided new
RDN.
|
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.
|
SearchResultEntry |
readEntry(Dn name,
String... attributeDescriptions)
Reads the named entry from the Directory Server.
|
SearchResultEntry |
readEntry(String 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.
|
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.
|
ConnectionEntryReader |
search(SearchRequest request)
Searches the Directory Server using the provided search parameters.
|
Result |
search(SearchRequest request,
Collection<? super SearchResultEntry> entries)
Searches the Directory Server using the provided search request.
|
Result |
search(SearchRequest request,
Collection<? super SearchResultEntry> entries,
Collection<? super SearchResultReference> references)
Searches the Directory Server using the provided search request.
|
Result |
search(SearchRequest request,
SearchResultHandler handler)
Searches the Directory Server using the provided search request.
|
ConnectionEntryReader |
search(String baseObject,
SearchScope scope,
String filter,
String... attributeDescriptions)
Searches the Directory Server using the provided search parameters.
|
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.
|
SearchResultEntry |
searchSingleEntry(SearchRequest request)
Searches the Directory Server for a single entry using the provided
search request.
|
SearchResultEntry |
searchSingleEntry(String baseObject,
SearchScope scope,
String filter,
String... attributeDescriptions)
Searches the Directory Server for a single entry using the provided
search parameters.
|
LdapPromise<SearchResultEntry> |
searchSingleEntryAsync(SearchRequest request)
Asynchronously searches the Directory Server for a single entry using the
provided search request.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
delete
protected final C extends Connection connection
protected AbstractConnectionWrapper(C connection)
connection
- The connection to be wrapped.public LdapPromise<Void> abandonAsync(AbandonRequest 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.
abandonAsync
in interface Connection
request
- The request identifying the operation to be abandoned.public Result add(AddRequest request) throws LdapException
The default implementation is to delegate.
add
in interface Connection
request
- The add request.LdapException
- If the result code indicates that the request failed for some
reason.public Result add(Entry entry) throws LdapException
This method is equivalent to the following code:
AddRequest request = new AddRequest(entry); connection.add(request);
The default implementation is to delegate.
add
in interface Connection
entry
- The entry to be added.LdapException
- If the result code indicates that the request failed for some
reason.public Result add(String... ldifLines) throws LdapException
This method is equivalent to the following code:
AddRequest request = new AddRequest(ldifLines); connection.add(request);
The default implementation is to delegate.
add
in interface Connection
ldifLines
- Lines of LDIF containing the an LDIF add change record or an
LDIF entry record.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<Result> addAsync(AddRequest request)
The default implementation is to delegate.
addAsync
in interface Connection
request
- The add request.public LdapPromise<Result> addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
addAsync
in interface Connection
request
- The add request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public void addConnectionEventListener(ConnectionEventListener listener)
The default implementation is to delegate.
addConnectionEventListener
in interface Connection
listener
- The listener which wants to be notified when events occur on
this connection.public Result applyChange(ChangeRecord request) throws LdapException
The default implementation is to delegate.
applyChange
in interface Connection
request
- The change request.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<Result> applyChangeAsync(ChangeRecord request)
The default implementation is to delegate.
applyChangeAsync
in interface Connection
request
- The change request.public LdapPromise<Result> applyChangeAsync(ChangeRecord request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
applyChangeAsync
in interface Connection
request
- The change request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public BindResult bind(BindRequest request) throws LdapException
The default implementation is to delegate.
bind
in interface Connection
request
- The bind request.LdapException
- If the result code indicates that the request failed for some
reason.public BindResult bind(String name, char[] password) throws LdapException
This method is equivalent to the following code:
BindRequest request = new SimpleBindRequest(name, password); connection.bind(request);
The default implementation is to delegate.
bind
in interface Connection
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.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<BindResult> bindAsync(BindRequest request)
The default implementation is to delegate.
bindAsync
in interface Connection
request
- The bind request.public LdapPromise<BindResult> bindAsync(BindRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
bindAsync
in interface Connection
request
- The bind request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public void close()
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);Calling
close
on a connection that is already closed has no
effect.
The default implementation is to delegate.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Connection
Connections.uncloseable(Connection)
public void close(UnbindRequest request, String reason)
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 close
on a connection that is already closed has no
effect.
The default implementation is to delegate.
close
in interface Connection
request
- The unbind request to use in the case where a physical
connection is closed.reason
- A reason describing why the connection was closed.public CompareResult compare(CompareRequest request) throws LdapException
The default implementation is to delegate.
compare
in interface Connection
request
- The compare request.LdapException
- If the result code indicates that the request failed for some
reason.public CompareResult compare(String name, String attributeDescription, String assertionValue) throws LdapException
This method is equivalent to the following code:
CompareRequest request = new CompareRequest(name, attributeDescription, assertionValue); connection.compare(request);
The default implementation is to delegate.
compare
in interface Connection
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.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<CompareResult> compareAsync(CompareRequest request)
The default implementation is to delegate.
compareAsync
in interface Connection
request
- The compare request.public LdapPromise<CompareResult> compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
compareAsync
in interface Connection
request
- The compare request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public Result delete(DeleteRequest request) throws LdapException
The default implementation is to delegate.
delete
in interface Connection
request
- The delete request.LdapException
- If the result code indicates that the request failed for some
reason.public Result delete(String name) throws LdapException
This method is equivalent to the following code:
DeleteRequest request = new DeleteRequest(name); connection.delete(request);
The default implementation is to delegate.
delete
in interface Connection
name
- The distinguished name of the entry to be deleted.LdapException
- If the result code indicates that the request failed for some reason.public LdapPromise<Result> deleteAsync(DeleteRequest request)
The default implementation is to delegate.
deleteAsync
in interface Connection
request
- The delete request.public LdapPromise<Result> deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
deleteAsync
in interface Connection
request
- The delete request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public Result deleteSubtree(String name) throws LdapException
This method is equivalent to the following code:
DeleteRequest request = new DeleteRequest(name).addControl( connection.delete(request);
The default implementation is to delegate.
deleteSubtree
in interface Connection
name
- The distinguished name of the subtree base entry to be
deleted.LdapException
- If the result code indicates that the request failed for some
reason.public <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request) throws LdapException
The default implementation is to delegate.
extendedRequest
in interface Connection
R
- The type of result returned by the extended request.request
- The extended request.LdapException
- If the result code indicates that the request failed for some
reason.public <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request, IntermediateResponseHandler handler) throws LdapException
The default implementation is to delegate.
extendedRequest
in interface Connection
R
- The type of result returned by the extended request.request
- The extended request.handler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.LdapException
- If the result code indicates that the request failed for some
reason.public GenericExtendedResult extendedRequest(String requestName, ByteString requestValue) throws LdapException
This method is equivalent to the following code:
GenericExtendedRequest request = new GenericExtendedRequest(requestName, requestValue); connection.extendedRequest(request);
The default implementation is to delegate.
extendedRequest
in interface Connection
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, or null
if there is no content.LdapException
- If the result code indicates that the request failed for some
reason.public <R extends ExtendedResult> LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request)
The default implementation is to delegate.
extendedRequestAsync
in interface Connection
R
- The type of result returned by the extended request.request
- The extended request.public <R extends ExtendedResult> LdapPromise<R> extendedRequestAsync(ExtendedRequest<R> request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
extendedRequestAsync
in interface Connection
R
- The type of result returned by the extended request.request
- The extended request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public boolean isClosed()
close
. This method will not return true
if a
fatal error has occurred on the connection unless close
has been
called.
The default implementation is to delegate.
isClosed
in interface Connection
true
if this connection has been explicitly closed by
calling close
, or false
otherwise.public boolean isValid()
true
if this connection has not been closed and no fatal
errors have been detected. This method is guaranteed to return
false
only when it is called after the method close
has
been called.
The default implementation is to delegate.
isValid
in interface Connection
true
if this connection is valid, false
otherwise.public Result modify(ModifyRequest request) throws LdapException
The default implementation is to delegate.
modify
in interface Connection
request
- The modify request.LdapException
- If the result code indicates that the request failed for some
reason.public Result modify(String... ldifLines) throws LdapException
This method is equivalent to the following code:
ModifyRequest request = new ModifyRequest(name, ldifChanges); connection.modify(request);
The default implementation is to delegate.
modify
in interface Connection
ldifLines
- Lines of LDIF containing the a single LDIF modify change
record.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<Result> modifyAsync(ModifyRequest request)
The default implementation is to delegate.
modifyAsync
in interface Connection
request
- The modify request.public LdapPromise<Result> modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
modifyAsync
in interface Connection
request
- The modify request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public Result modifyDn(ModifyDnRequest request) throws LdapException
The default implementation is to delegate.
modifyDn
in interface Connection
request
- The modify DN request.LdapException
- If the result code indicates that the request failed for some
reason.public Result modifyDn(String name, String newRDN) throws LdapException
This method is equivalent to the following code:
ModifyDNRequest request = new ModifyDNRequest(name, newRDN); connection.modifyDN(request);
The default implementation is to delegate.
modifyDn
in interface Connection
name
- The distinguished name of the entry to be renamed.newRDN
- The new RDN of the entry.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<Result> modifyDnAsync(ModifyDnRequest request)
The default implementation is to delegate.
modifyDnAsync
in interface Connection
request
- The modify DN request.public LdapPromise<Result> modifyDnAsync(ModifyDnRequest request, IntermediateResponseHandler intermediateResponseHandler)
The default implementation is to delegate.
modifyDnAsync
in interface Connection
request
- The modify DN request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.public SearchResultEntry readEntry(Dn name, String... attributeDescriptions) throws LdapException
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 return null
.
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.
readEntry
in interface Connection
name
- The distinguished name of the entry to be read.attributeDescriptions
- The names of the attributes to be included with the entry,
which may be null
or empty indicating that all user
attributes should be returned.LdapException
- If the result code indicates that the request failed for some
reason.public SearchResultEntry readEntry(String name, String... attributeDescriptions) throws LdapException
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 return null
.
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.
readEntry
in interface Connection
name
- The distinguished name of the entry to be read.attributeDescriptions
- The names of the attributes to be included with the entry.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<SearchResultEntry> readEntryAsync(Dn name, Collection<String> attributeDescriptions)
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 return null
.
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.
readEntryAsync
in interface Connection
name
- The distinguished name of the entry to be read.attributeDescriptions
- The names of the attributes to be included with the entry,
which may be null
or empty indicating that all user
attributes should be returned.public void removeConnectionEventListener(ConnectionEventListener listener)
The default implementation is to delegate.
removeConnectionEventListener
in interface Connection
listener
- The listener which no longer wants to be notified when events
occur on this connection.public ConnectionEntryReader search(SearchRequest request)
ConnectionEntryReader
.
Unless otherwise specified, calling this method is equivalent to:
ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
The default implementation is to delegate.
search
in interface Connection
request
- The search request.public Result search(SearchRequest request, Collection<? super SearchResultEntry> entries) throws LdapException
entries
,
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.
search
in interface Connection
request
- The search request.entries
- The collection to which matching entries should be added.LdapException
- If the result code indicates that the request failed for some
reason.public Result search(SearchRequest request, Collection<? super SearchResultEntry> entries, Collection<? super SearchResultReference> references) throws LdapException
entries
,
even if the final search result indicates that the search failed.
Similarly, search result references returned by the search will be added
to references
.
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.
search
in interface Connection
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, or null
if references are to be discarded.LdapException
- If the result code indicates that the request failed for some
reason.public Result search(SearchRequest request, SearchResultHandler handler) throws LdapException
The default implementation is to delegate.
search
in interface Connection
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
be null
.LdapException
- If the result code indicates that the request failed for some
reason.public ConnectionEntryReader search(String baseObject, SearchScope scope, String filter, String... attributeDescriptions)
EntryReader
interface.
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.
search
in interface Connection
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.public LdapPromise<Result> searchAsync(SearchRequest request, SearchResultHandler resultHandler)
The default implementation is to delegate.
searchAsync
in interface Connection
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 be null
.public LdapPromise<Result> searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler)
The default implementation is to delegate.
searchAsync
in interface Connection
request
- The search request.intermediateResponseHandler
- An intermediate response handler which can be used to process
any intermediate responses as they are received, may be
null
.entryHandler
- A search result handler which can be used to asynchronously
process the search result entries and references as they are
received, may be null
.public SearchResultEntry searchSingleEntry(SearchRequest request) throws LdapException
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 return null
. If multiple
matching entries are returned by the Directory Server then the request
will fail with an MultipleEntriesFoundException
.
The default implementation is to delegate.
searchSingleEntry
in interface Connection
request
- The search request.LdapException
- If the result code indicates that the request failed for some
reason.public SearchResultEntry searchSingleEntry(String baseObject, SearchScope scope, String filter, String... attributeDescriptions) throws LdapException
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 return null
. If multiple
matching entries are returned by the Directory Server then the request
will fail with an MultipleEntriesFoundException
.
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.
searchSingleEntry
in interface Connection
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.LdapException
- If the result code indicates that the request failed for some
reason.public LdapPromise<SearchResultEntry> searchSingleEntryAsync(SearchRequest 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 return null
. If
multiple matching entries are returned by the Directory Server then the
request will fail with an MultipleEntriesFoundException
.
The default implementation is to delegate.
searchSingleEntryAsync
in interface Connection
request
- The search request.Copyright 2010-2022 ForgeRock AS.