Class LdapConnection

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class LdapConnection
    extends Object
    implements Closeable
    Provides an adapted view of an OpenDJ LDAP connection exposing only the synchronous methods and protecting against future evolution of the Connection interface (e.g. migration to Promises).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.forgerock.opendj.ldap.messages.Result add​(String... ldifLines)
      Adds an entry to the Directory Server using the provided lines of LDIF.
      org.forgerock.opendj.ldap.messages.Result add​(org.forgerock.opendj.ldap.Entry entry)
      Adds the provided entry to the Directory Server.
      org.forgerock.opendj.ldap.messages.Result add​(org.forgerock.opendj.ldap.messages.AddRequest request)
      Adds an entry to the Directory Server using the provided add request.
      org.forgerock.opendj.ldap.messages.BindResult bind​(String name, char[] password)
      Authenticates to the Directory Server using simple authentication and the provided user name and password.
      org.forgerock.opendj.ldap.messages.BindResult bind​(org.forgerock.opendj.ldap.messages.BindRequest request)
      Authenticates to the Directory Server using the provided bind request.
      void close()
      Releases any resources associated with this connection.
      org.forgerock.opendj.ldap.messages.CompareResult compare​(String name, String attributeDescription, String assertionValue)
      Compares the named entry in the Directory Server against the provided attribute value assertion.
      org.forgerock.opendj.ldap.messages.CompareResult compare​(org.forgerock.opendj.ldap.messages.CompareRequest request)
      Compares an entry in the Directory Server using the provided compare request.
      org.forgerock.opendj.ldap.messages.Result delete​(String name)
      Deletes the named entry from the Directory Server.
      org.forgerock.opendj.ldap.messages.Result delete​(org.forgerock.opendj.ldap.messages.DeleteRequest request)
      Deletes an entry from the Directory Server using the provided delete request.
      org.forgerock.opendj.ldap.messages.Result deleteSubtree​(String name)
      Deletes the named entry and all of its subordinates from the Directory Server.
      org.forgerock.opendj.ldap.messages.Result modify​(String... ldifLines)
      Modifies an entry in the Directory Server using the provided lines of LDIF.
      org.forgerock.opendj.ldap.messages.Result modify​(org.forgerock.opendj.ldap.messages.ModifyRequest request)
      Modifies an entry in the Directory Server using the provided modify request.
      org.forgerock.opendj.ldap.messages.Result modifyDN​(String name, String newRDN)
      Renames the named entry in the Directory Server using the provided new RDN.
      org.forgerock.opendj.ldap.messages.Result modifyDN​(org.forgerock.opendj.ldap.messages.ModifyDnRequest request)
      Renames an entry in the Directory Server using the provided modify DN request.
      org.forgerock.opendj.ldap.messages.SearchResultEntry readEntry​(String name, String... attributeDescriptions)
      Reads the named entry from the Directory Server.
      org.forgerock.opendj.ldap.messages.SearchResultEntry readEntry​(org.forgerock.opendj.ldap.Dn name, String... attributeDescriptions)
      Reads the named entry from the Directory Server.
      org.forgerock.opendj.ldif.ConnectionEntryReader search​(String baseObject, org.forgerock.opendj.ldap.SearchScope scope, String filter, String... attributeDescriptions)
      Searches the Directory Server using the provided search parameters.
      org.forgerock.opendj.ldif.ConnectionEntryReader search​(org.forgerock.opendj.ldap.messages.SearchRequest request)
      Searches the Directory Server using the provided search parameters.
      org.forgerock.opendj.ldap.messages.Result search​(org.forgerock.opendj.ldap.messages.SearchRequest request, Collection<? super org.forgerock.opendj.ldap.messages.SearchResultEntry> entries)
      Searches the Directory Server using the provided search request.
      org.forgerock.opendj.ldap.messages.Result search​(org.forgerock.opendj.ldap.messages.SearchRequest request, Collection<? super org.forgerock.opendj.ldap.messages.SearchResultEntry> entries, Collection<? super org.forgerock.opendj.ldap.messages.SearchResultReference> references)
      Searches the Directory Server using the provided search request.
      org.forgerock.opendj.ldap.messages.SearchResultEntry searchSingleEntry​(String baseObject, org.forgerock.opendj.ldap.SearchScope scope, String filter, String... attributeDescriptions)
      Searches the Directory Server for a single entry using the provided search parameters.
      org.forgerock.opendj.ldap.messages.SearchResultEntry searchSingleEntry​(org.forgerock.opendj.ldap.messages.SearchRequest request)
      Searches the Directory Server for a single entry using the provided search request.
    • Method Detail

      • add

        public org.forgerock.opendj.ldap.messages.Result add​(org.forgerock.opendj.ldap.messages.AddRequest request)
                                                      throws org.forgerock.opendj.ldap.LdapException
        Adds an entry to the Directory Server using the provided add request.
        Parameters:
        request - The add request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support add operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • add

        public org.forgerock.opendj.ldap.messages.Result add​(org.forgerock.opendj.ldap.Entry entry)
                                                      throws org.forgerock.opendj.ldap.LdapException
        Adds the provided entry to the Directory Server.

        This method is equivalent to the following code:

         
         AddRequest request = newAddRequest(entry);
         connection.add(request);
         
         
        Parameters:
        entry - The entry to be added.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support add operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If entry was null .
      • add

        public org.forgerock.opendj.ldap.messages.Result add​(String... ldifLines)
                                                      throws org.forgerock.opendj.ldap.LdapException
        Adds an entry to the Directory Server using the provided lines of LDIF.

        This method is equivalent to the following code:

         
         AddRequest request = newAddRequest(ldifLines);
         connection.add(request);
         
         
        Parameters:
        ldifLines - Lines of LDIF containing the an LDIF add change record or an LDIF entry record.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support add operations.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If ldifLines was empty, or contained invalid LDIF, or could not be decoded using the default schema.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If ldifLines was null .
      • bind

        public org.forgerock.opendj.ldap.messages.BindResult bind​(org.forgerock.opendj.ldap.messages.BindRequest request)
                                                           throws org.forgerock.opendj.ldap.LdapException
        Authenticates to the Directory Server using the provided bind request.
        Parameters:
        request - The bind request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support bind operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • bind

        public org.forgerock.opendj.ldap.messages.BindResult bind​(String name,
                                                                  char[] password)
                                                           throws org.forgerock.opendj.ldap.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 = newSimpleBindRequest(name, password);
         connection.bind(request);
         
         
        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:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If name could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support bind operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If name or password was null.
      • 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);
         
         

        Calling close on a connection that is already closed has no effect.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        See Also:
        Connections.uncloseable(Connection)
      • compare

        public org.forgerock.opendj.ldap.messages.CompareResult compare​(org.forgerock.opendj.ldap.messages.CompareRequest request)
                                                                 throws org.forgerock.opendj.ldap.LdapException
        Compares an entry in the Directory Server using the provided compare request.
        Parameters:
        request - The compare request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support compare operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • compare

        public org.forgerock.opendj.ldap.messages.CompareResult compare​(String name,
                                                                        String attributeDescription,
                                                                        String assertionValue)
                                                                 throws org.forgerock.opendj.ldap.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 = newCompareRequest(name, attributeDescription, assertionValue);
         connection.compare(request);
         
         
        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:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If name or AttributeDescription could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support compare operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If name, attributeDescription, or assertionValue was null.
      • delete

        public org.forgerock.opendj.ldap.messages.Result delete​(org.forgerock.opendj.ldap.messages.DeleteRequest request)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Deletes an entry from the Directory Server using the provided delete request.
        Parameters:
        request - The delete request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support delete operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • delete

        public org.forgerock.opendj.ldap.messages.Result delete​(String name)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Deletes the named entry from the Directory Server.

        This method is equivalent to the following code:

         
         DeleteRequest request = newDeleteRequest(name);
         connection.delete(request);
         
         
        Parameters:
        name - The distinguished name of the entry to be deleted.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If name could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support delete operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If name was null.
      • deleteSubtree

        public org.forgerock.opendj.ldap.messages.Result deleteSubtree​(String name)
                                                                throws org.forgerock.opendj.ldap.LdapException
        Deletes the named entry and all of its subordinates from the Directory Server.

        This method is equivalent to the following code:

         
         DeleteRequest request = newDeleteRequest(name).addControl(SubtreeDeleteRequestControl.newControl(true)));
         connection.delete(request);
         
         
        Parameters:
        name - The distinguished name of the subtree base entry to be deleted.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If name could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support delete operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If name was null.
      • modify

        public org.forgerock.opendj.ldap.messages.Result modify​(org.forgerock.opendj.ldap.messages.ModifyRequest request)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Modifies an entry in the Directory Server using the provided modify request.
        Parameters:
        request - The modify request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support modify operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • modify

        public org.forgerock.opendj.ldap.messages.Result modify​(String... ldifLines)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Modifies an entry in the Directory Server using the provided lines of LDIF.

        This method is equivalent to the following code:

         
         ModifyRequest request = newModifyRequest(ldifLines);
         connection.modify(request);
         
         
        Parameters:
        ldifLines - Lines of LDIF containing the a single LDIF modify change record.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support modify operations.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If ldifLines was empty, or contained invalid LDIF, or could not be decoded using the default schema.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If ldifLines was null .
      • modifyDN

        public org.forgerock.opendj.ldap.messages.Result modifyDN​(org.forgerock.opendj.ldap.messages.ModifyDnRequest request)
                                                           throws org.forgerock.opendj.ldap.LdapException
        Renames an entry in the Directory Server using the provided modify DN request.
        Parameters:
        request - The modify DN request.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support modify DN operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request was null.
      • modifyDN

        public org.forgerock.opendj.ldap.messages.Result modifyDN​(String name,
                                                                  String newRDN)
                                                           throws org.forgerock.opendj.ldap.LdapException
        Renames the named entry in the Directory Server using the provided new RDN.

        This method is equivalent to the following code:

         
         ModifyDNRequest request = newModifyDNRequest(name, newRDN);
         connection.modifyDN(request);
         
         
        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:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If name or newRDN could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support modify DN operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If name or newRDN was null.
      • readEntry

        public org.forgerock.opendj.ldap.messages.SearchResultEntry readEntry​(org.forgerock.opendj.ldap.Dn name,
                                                                              String... attributeDescriptions)
                                                                       throws org.forgerock.opendj.ldap.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 return null.

        This method is equivalent to the following code:

         
         SearchRequest request =
                 new SearchRequest(name, SearchScope.BASE_OBJECT, &quot;(objectClass=*)&quot;, attributeDescriptions);
         connection.searchSingleEntry(request);
         
         
        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 be null or empty indicating that all user attributes should be returned.
        Returns:
        The single search result entry returned from the search.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If the name was null.
      • readEntry

        public org.forgerock.opendj.ldap.messages.SearchResultEntry readEntry​(String name,
                                                                              String... attributeDescriptions)
                                                                       throws org.forgerock.opendj.ldap.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 return null.

        This method is equivalent to the following code:

         
         SearchRequest request =
                 new SearchRequest(name, SearchScope.BASE_OBJECT, &quot;(objectClass=*)&quot;, attributeDescriptions);
         connection.searchSingleEntry(request);
         
         
        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:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If baseObject could not be decoded using the default schema.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If the name was null.
      • search

        public org.forgerock.opendj.ldif.ConnectionEntryReader search​(org.forgerock.opendj.ldap.messages.SearchRequest request)
        Searches the Directory Server using the provided search parameters. Any matching entries returned by the search will be exposed through the returned ConnectionEntryReader.

        Unless otherwise specified, calling this method is equivalent to:

         
         ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
         
         
        Parameters:
        request - The search request.
        Returns:
        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. if isClosed() == true.
        NullPointerException - If request or entries was null.
      • search

        public org.forgerock.opendj.ldap.messages.Result search​(org.forgerock.opendj.ldap.messages.SearchRequest request,
                                                                Collection<? super org.forgerock.opendj.ldap.messages.SearchResultEntry> entries)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Searches the Directory Server using the provided search request. Any matching entries returned by the search will be added to 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);
         
         
        Parameters:
        request - The search request.
        entries - The collection to which matching entries should be added.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request or entries was null.
      • search

        public org.forgerock.opendj.ldap.messages.Result search​(org.forgerock.opendj.ldap.messages.SearchRequest request,
                                                                Collection<? super org.forgerock.opendj.ldap.messages.SearchResultEntry> entries,
                                                                Collection<? super org.forgerock.opendj.ldap.messages.SearchResultReference> references)
                                                         throws org.forgerock.opendj.ldap.LdapException
        Searches the Directory Server using the provided search request. Any matching entries returned by the search will be added to 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.

        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, or null if references are to be discarded.
        Returns:
        The result of the operation.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If request or entries was null.
      • search

        public org.forgerock.opendj.ldif.ConnectionEntryReader search​(String baseObject,
                                                                      org.forgerock.opendj.ldap.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 the 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&lt;Response&gt;());
         
         
        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.
        Throws:
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If the baseObject, scope, or filter were null.
      • searchSingleEntry

        public org.forgerock.opendj.ldap.messages.SearchResultEntry searchSingleEntry​(org.forgerock.opendj.ldap.messages.SearchRequest request)
                                                                               throws org.forgerock.opendj.ldap.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 return null. If multiple matching entries are returned by the Directory Server then the request will fail with an MultipleEntriesFoundException.

        Parameters:
        request - The search request.
        Returns:
        The single search result entry returned from the search.
        Throws:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If the request was null.
      • searchSingleEntry

        public org.forgerock.opendj.ldap.messages.SearchResultEntry searchSingleEntry​(String baseObject,
                                                                                      org.forgerock.opendj.ldap.SearchScope scope,
                                                                                      String filter,
                                                                                      String... attributeDescriptions)
                                                                               throws org.forgerock.opendj.ldap.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 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);
         
         
        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:
        org.forgerock.opendj.ldap.LdapException - If the result code indicates that the request failed for some reason.
        org.forgerock.i18n.LocalizedIllegalArgumentException - If baseObject could not be decoded using the default schema or if filter is not a valid LDAP string representation of a filter.
        UnsupportedOperationException - If this connection does not support search operations.
        IllegalStateException - If this connection has already been closed, i.e. if isClosed() == true.
        NullPointerException - If the baseObject, scope, or filter were null.