Class LDAPConnection


  • @Mutable
    @NotExtensible
    @ThreadSafety(level=NOT_THREADSAFE)
    public class LDAPConnection
    extends java.lang.Object
    This class provides an object that may be used to communicate with an LDAP directory server.

    This class is primarily intended to be used in the process of updating applications which use the Netscape Directory SDK for Java to switch to or coexist with the UnboundID LDAP SDK for Java. For applications not written using the Netscape Directory SDK for Java, the LDAPConnection class should be used instead.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEREF_ALWAYS
      The integer value for the DEREF_ALWAYS dereference policy.
      static int DEREF_FINDING
      The integer value for the DEREF_FINDING dereference policy.
      static int DEREF_NEVER
      The integer value for the DEREF_NEVER dereference policy.
      static int DEREF_SEARCHING
      The integer value for the DEREF_SEARCHING dereference policy.
      static int SCOPE_BASE
      The integer value for the SCOPE_BASE search scope.
      static int SCOPE_ONE
      The integer value for the SCOPE_ONE search scope.
      static int SCOPE_SUB
      The integer value for the SCOPE_SUB search scope.
    • Constructor Summary

      Constructors 
      Constructor Description
      LDAPConnection()
      Creates a new LDAP connection which will use the default socket factory.
      LDAPConnection​(LDAPSocketFactory socketFactory)
      Creates a new LDAP connection which will use the provided socket factory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abandon​(int id)
      Sends a request to abandon the request with the specified message ID.
      void abandon​(LDAPSearchResults searchResults)
      Sends a request to abandon the provided search operation.
      void add​(LDAPEntry entry)
      Adds the provided entry to the directory.
      void add​(LDAPEntry entry, LDAPConstraints constraints)
      Adds the provided entry to the directory.
      void authenticate​(int version, java.lang.String dn, java.lang.String password)
      Authenticates to the directory server using a simple bind with the provided information.
      void authenticate​(int version, java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Authenticates to the directory server using a simple bind with the provided information.
      void authenticate​(java.lang.String dn, java.lang.String password)
      Authenticates to the directory server using a simple bind with the provided information.
      void authenticate​(java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Authenticates to the directory server using a simple bind with the provided information.
      void bind​(int version, java.lang.String dn, java.lang.String password)
      Authenticates to the directory server using a simple bind with the provided information.
      void bind​(int version, java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Authenticates to the directory server using a simple bind with the provided information.
      void bind​(java.lang.String dn, java.lang.String password)
      Authenticates to the directory server using a simple bind with the provided information.
      void bind​(java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Authenticates to the directory server using a simple bind with the provided information.
      boolean compare​(java.lang.String dn, LDAPAttribute attribute)
      Indicates whether the specified entry has the given attribute value.
      boolean compare​(java.lang.String dn, LDAPAttribute attribute, LDAPConstraints constraints)
      Indicates whether the specified entry has the given attribute value.
      void connect​(int version, java.lang.String host, int port, java.lang.String dn, java.lang.String password)
      Attempts to establish and authenticate this connection with the provided information.
      void connect​(int version, java.lang.String host, int port, java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Attempts to establish and authenticate this connection with the provided information.
      void connect​(java.lang.String host, int port)
      Attempts to establish this connection with the provided information.
      void connect​(java.lang.String host, int port, java.lang.String dn, java.lang.String password)
      Attempts to establish and authenticate this connection with the provided information.
      void connect​(java.lang.String host, int port, java.lang.String dn, java.lang.String password, LDAPConstraints constraints)
      Attempts to establish and authenticate this connection with the provided information.
      void delete​(java.lang.String dn)
      Removes an entry from the directory.
      void delete​(java.lang.String dn, LDAPConstraints constraints)
      Removes an entry from the directory.
      void disconnect()
      Unbinds and disconnects from the directory server.
      LDAPExtendedOperation extendedOperation​(LDAPExtendedOperation extendedOperation)
      Processes an extended operation in the directory.
      LDAPExtendedOperation extendedOperation​(LDAPExtendedOperation extendedOperation, LDAPConstraints constraints)
      Processes an extended operation in the directory.
      protected void finalize()
      Closes the connection to the server if the client forgets to do so.
      java.lang.String getAuthenticationDN()
      Retrieves the DN of the user that last authenticated on this connection.
      java.lang.String getAuthenticationPassword()
      Retrieves the password of the user that last authenticated on this connection.
      int getConnectTimeout()
      Retrieves the maximum length of time to wait for the connection to be established, in seconds.
      LDAPConstraints getConstraints()
      Retrieves the constraints for this connection.
      java.lang.String getHost()
      Retrieves the address to which the connection is established.
      int getPort()
      Retrieves the port to which the connection is established.
      LDAPControl[] getResponseControls()
      Retrieves the response controls from the last operation processed on this connection.
      LDAPConnection getSDKConnection()
      Retrieves the LDAPConnection object used to back this connection.
      LDAPSearchConstraints getSearchConstraints()
      Retrieves the search constraints for this connection.
      LDAPSocketFactory getSocketFactory()
      Retrieves the socket factory for this LDAP connection, if specified.
      boolean isConnected()
      Indicates whether this connection is currently established.
      void modify​(java.lang.String dn, LDAPModification mod)
      Modifies an entry in the directory.
      void modify​(java.lang.String dn, LDAPModification[] mods)
      Modifies an entry in the directory.
      void modify​(java.lang.String dn, LDAPModification[] mods, LDAPConstraints constraints)
      Modifies an entry in the directory.
      void modify​(java.lang.String dn, LDAPModification mod, LDAPConstraints constraints)
      Modifies an entry in the directory.
      void modify​(java.lang.String dn, LDAPModificationSet mods)
      Modifies an entry in the directory.
      void modify​(java.lang.String dn, LDAPModificationSet mods, LDAPConstraints constraints)
      Modifies an entry in the directory.
      LDAPEntry read​(java.lang.String dn)
      Retrieves an entry from the directory server.
      LDAPEntry read​(java.lang.String dn, LDAPSearchConstraints constraints)
      Retrieves an entry from the directory server.
      LDAPEntry read​(java.lang.String dn, java.lang.String[] attrs)
      Retrieves an entry from the directory server.
      LDAPEntry read​(java.lang.String dn, java.lang.String[] attrs, LDAPSearchConstraints constraints)
      Retrieves an entry from the directory server.
      void reconnect()
      Disconnects from the directory server and attempts to re-connect and re-authenticate.
      void rename​(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN)
      Alters the DN of an entry in the directory.
      void rename​(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN, LDAPConstraints constraints)
      Alters the DN of an entry in the directory.
      void rename​(java.lang.String dn, java.lang.String newRDN, java.lang.String newParentDN, boolean deleteOldRDN)
      Alters the DN of an entry in the directory.
      void rename​(java.lang.String dn, java.lang.String newRDN, java.lang.String newParentDN, boolean deleteOldRDN, LDAPConstraints constraints)
      Alters the DN of an entry in the directory.
      LDAPSearchResults search​(java.lang.String baseDN, int scope, java.lang.String filter, java.lang.String[] attributes, boolean typesOnly)
      Processes a search in the directory server.
      LDAPSearchResults search​(java.lang.String baseDN, int scope, java.lang.String filter, java.lang.String[] attributes, boolean typesOnly, LDAPSearchConstraints constraints)
      Processes a search in the directory server.
      void setConnectTimeout​(int timeout)
      Specifies the maximum length of time to wait for the connection to be established, in seconds.
      void setConstraints​(LDAPConstraints constraints)
      Updates the constraints for this connection.
      void setSearchConstraints​(LDAPSearchConstraints searchConstraints)
      Updates the search constraints for this connection.
      void setSocketFactory​(LDAPSocketFactory socketFactory)
      Sets the socket factory for this LDAP connection.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEREF_NEVER

        public static final int DEREF_NEVER
        The integer value for the DEREF_NEVER dereference policy.
      • DEREF_SEARCHING

        public static final int DEREF_SEARCHING
        The integer value for the DEREF_SEARCHING dereference policy.
      • DEREF_FINDING

        public static final int DEREF_FINDING
        The integer value for the DEREF_FINDING dereference policy.
      • DEREF_ALWAYS

        public static final int DEREF_ALWAYS
        The integer value for the DEREF_ALWAYS dereference policy.
    • Constructor Detail

      • LDAPConnection

        public LDAPConnection()
        Creates a new LDAP connection which will use the default socket factory.
      • LDAPConnection

        public LDAPConnection​(@Nullable
                              LDAPSocketFactory socketFactory)
        Creates a new LDAP connection which will use the provided socket factory.
        Parameters:
        socketFactory - The socket factory to use when creating the socket to use for communicating with the server.
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Closes the connection to the server if the client forgets to do so.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - If a problem occurs.
      • getHost

        @Nullable
        public java.lang.String getHost()
        Retrieves the address to which the connection is established.
        Returns:
        The address to which the connection is established.
      • getPort

        public int getPort()
        Retrieves the port to which the connection is established.
        Returns:
        The port to which the connection is established.
      • getAuthenticationDN

        @Nullable
        public java.lang.String getAuthenticationDN()
        Retrieves the DN of the user that last authenticated on this connection.
        Returns:
        The DN of the user that last authenticated on this connection, or null if it is not available.
      • getAuthenticationPassword

        @Nullable
        public java.lang.String getAuthenticationPassword()
        Retrieves the password of the user that last authenticated on this connection.
        Returns:
        The password of the user that last authenticated on this connection, or null if it is not available.
      • getConnectTimeout

        public int getConnectTimeout()
        Retrieves the maximum length of time to wait for the connection to be established, in seconds.
        Returns:
        The maximum length of time to wait for the connection to be established.
      • setConnectTimeout

        public void setConnectTimeout​(int timeout)
        Specifies the maximum length of time to wait for the connection to be established, in seconds.
        Parameters:
        timeout - The maximum length of time to wait for the connection to be established.
      • getSocketFactory

        @Nullable
        public LDAPSocketFactory getSocketFactory()
        Retrieves the socket factory for this LDAP connection, if specified.
        Returns:
        The socket factory for this LDAP connection, or null if none has been provided.
      • setSocketFactory

        public void setSocketFactory​(@Nullable
                                     LDAPSocketFactory socketFactory)
        Sets the socket factory for this LDAP connection.
        Parameters:
        socketFactory - The socket factory for this LDAP connection.
      • setConstraints

        public void setConstraints​(@Nullable
                                   LDAPConstraints constraints)
        Updates the constraints for this connection.
        Parameters:
        constraints - The constraints for this connection.
      • getResponseControls

        @Nullable
        public LDAPControl[] getResponseControls()
        Retrieves the response controls from the last operation processed on this connection.
        Returns:
        The response controls from the last operation processed on this connection, or null if there were none.
      • isConnected

        public boolean isConnected()
        Indicates whether this connection is currently established.
        Returns:
        true if this connection is currently established, or false if not.
      • connect

        public void connect​(@NotNull
                            java.lang.String host,
                            int port)
                     throws LDAPException
        Attempts to establish this connection with the provided information.
        Parameters:
        host - The address of the server to which the connection should be established.
        port - The port of the server to which the connection should be established.
        Throws:
        LDAPException - If a problem occurs while attempting to establish this connection.
      • connect

        public void connect​(@NotNull
                            java.lang.String host,
                            int port,
                            @Nullable
                            java.lang.String dn,
                            @Nullable
                            java.lang.String password)
                     throws LDAPException
        Attempts to establish and authenticate this connection with the provided information.
        Parameters:
        host - The address of the server to which the connection should be established.
        port - The port of the server to which the connection should be established.
        dn - The DN to use to bind to the server.
        password - The password to use to bind to the server.
        Throws:
        LDAPException - If a problem occurs while attempting to establish or authenticate this connection. If an exception is thrown, then the connection will not be established.
      • connect

        public void connect​(@NotNull
                            java.lang.String host,
                            int port,
                            @Nullable
                            java.lang.String dn,
                            @Nullable
                            java.lang.String password,
                            @Nullable
                            LDAPConstraints constraints)
                     throws LDAPException
        Attempts to establish and authenticate this connection with the provided information.
        Parameters:
        host - The address of the server to which the connection should be established.
        port - The port of the server to which the connection should be established.
        dn - The DN to use to bind to the server.
        password - The password to use to bind to the server.
        constraints - The constraints to use when processing the bind.
        Throws:
        LDAPException - If a problem occurs while attempting to establish or authenticate this connection. If an exception is thrown, then the connection will not be established.
      • connect

        public void connect​(int version,
                            @NotNull
                            java.lang.String host,
                            int port,
                            @Nullable
                            java.lang.String dn,
                            @Nullable
                            java.lang.String password)
                     throws LDAPException
        Attempts to establish and authenticate this connection with the provided information.
        Parameters:
        version - The LDAP protocol version to use for the connection. This will be ignored, since this implementation only supports LDAPv3.
        host - The address of the server to which the connection should be established.
        port - The port of the server to which the connection should be established.
        dn - The DN to use to bind to the server.
        password - The password to use to bind to the server.
        Throws:
        LDAPException - If a problem occurs while attempting to establish or authenticate this connection. If an exception is thrown, then the connection will not be established.
      • connect

        public void connect​(int version,
                            @NotNull
                            java.lang.String host,
                            int port,
                            @Nullable
                            java.lang.String dn,
                            @Nullable
                            java.lang.String password,
                            @Nullable
                            LDAPConstraints constraints)
                     throws LDAPException
        Attempts to establish and authenticate this connection with the provided information.
        Parameters:
        version - The LDAP protocol version to use for the connection. This will be ignored, since this implementation only supports LDAPv3.
        host - The address of the server to which the connection should be established.
        port - The port of the server to which the connection should be established.
        dn - The DN to use to bind to the server.
        password - The password to use to bind to the server.
        constraints - The constraints to use when processing the bind.
        Throws:
        LDAPException - If a problem occurs while attempting to establish or authenticate this connection. If an exception is thrown, then the connection will not be established.
      • reconnect

        public void reconnect()
                       throws LDAPException
        Disconnects from the directory server and attempts to re-connect and re-authenticate.
        Throws:
        LDAPException - If a problem occurs. If an exception is thrown, the connection will have been closed.
      • abandon

        public void abandon​(int id)
                     throws LDAPException
        Sends a request to abandon the request with the specified message ID.
        Parameters:
        id - The message ID of the operation to abandon.
        Throws:
        LDAPException - If a problem occurs while sending the request.
      • abandon

        public void abandon​(@NotNull
                            LDAPSearchResults searchResults)
                     throws LDAPException
        Sends a request to abandon the provided search operation.
        Parameters:
        searchResults - The search results object for the search to abandon.
        Throws:
        LDAPException - If a problem occurs while sending the request.
      • authenticate

        public void authenticate​(@Nullable
                                 java.lang.String dn,
                                 @Nullable
                                 java.lang.String password)
                          throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        Throws:
        LDAPException - If the bind attempt fails.
      • authenticate

        public void authenticate​(@Nullable
                                 java.lang.String dn,
                                 @Nullable
                                 java.lang.String password,
                                 @Nullable
                                 LDAPConstraints constraints)
                          throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        constraints - The constraints to use for the bind operation.
        Throws:
        LDAPException - If the bind attempt fails.
      • authenticate

        public void authenticate​(int version,
                                 @Nullable
                                 java.lang.String dn,
                                 @Nullable
                                 java.lang.String password)
                          throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        version - The LDAP protocol version to use. This will be ignored, since this implementation only supports LDAPv3.
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        Throws:
        LDAPException - If the bind attempt fails.
      • authenticate

        public void authenticate​(int version,
                                 @Nullable
                                 java.lang.String dn,
                                 @Nullable
                                 java.lang.String password,
                                 @Nullable
                                 LDAPConstraints constraints)
                          throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        version - The LDAP protocol version to use. This will be ignored, since this implementation only supports LDAPv3.
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        constraints - The constraints to use for the bind operation.
        Throws:
        LDAPException - If the bind attempt fails.
      • bind

        public void bind​(@Nullable
                         java.lang.String dn,
                         @Nullable
                         java.lang.String password)
                  throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        Throws:
        LDAPException - If the bind attempt fails.
      • bind

        public void bind​(@Nullable
                         java.lang.String dn,
                         @Nullable
                         java.lang.String password,
                         @Nullable
                         LDAPConstraints constraints)
                  throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        constraints - The constraints to use for the bind operation.
        Throws:
        LDAPException - If the bind attempt fails.
      • bind

        public void bind​(int version,
                         @Nullable
                         java.lang.String dn,
                         @Nullable
                         java.lang.String password)
                  throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        version - The LDAP protocol version to use. This will be ignored, since this implementation only supports LDAPv3.
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        Throws:
        LDAPException - If the bind attempt fails.
      • bind

        public void bind​(int version,
                         @Nullable
                         java.lang.String dn,
                         @Nullable
                         java.lang.String password,
                         @Nullable
                         LDAPConstraints constraints)
                  throws LDAPException
        Authenticates to the directory server using a simple bind with the provided information.
        Parameters:
        version - The LDAP protocol version to use. This will be ignored, since this implementation only supports LDAPv3.
        dn - The DN of the user for the bind.
        password - The password to use for the bind.
        constraints - The constraints to use for the bind operation.
        Throws:
        LDAPException - If the bind attempt fails.
      • compare

        public boolean compare​(@NotNull
                               java.lang.String dn,
                               @NotNull
                               LDAPAttribute attribute)
                        throws LDAPException
        Indicates whether the specified entry has the given attribute value.
        Parameters:
        dn - The DN of the entry to compare.
        attribute - The attribute (which must have exactly one value) to use for the comparison.
        Returns:
        true if the compare matched the target entry, or false if not.
        Throws:
        LDAPException - If a problem occurs while processing the compare.
      • compare

        public boolean compare​(@NotNull
                               java.lang.String dn,
                               @NotNull
                               LDAPAttribute attribute,
                               @Nullable
                               LDAPConstraints constraints)
                        throws LDAPException
        Indicates whether the specified entry has the given attribute value.
        Parameters:
        dn - The DN of the entry to compare.
        attribute - The attribute (which must have exactly one value) to use for the comparison.
        constraints - The constraints to use for the compare operation.
        Returns:
        true if the compare matched the target entry, or false if not.
        Throws:
        LDAPException - If a problem occurs while processing the compare.
      • delete

        public void delete​(@NotNull
                           java.lang.String dn)
                    throws LDAPException
        Removes an entry from the directory.
        Parameters:
        dn - The DN of the entry to delete.
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • delete

        public void delete​(@NotNull
                           java.lang.String dn,
                           @Nullable
                           LDAPConstraints constraints)
                    throws LDAPException
        Removes an entry from the directory.
        Parameters:
        dn - The DN of the entry to delete.
        constraints - The constraints to use for the delete operation.
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • modify

        public void modify​(@NotNull
                           java.lang.String dn,
                           @NotNull
                           LDAPModification[] mods)
                    throws LDAPException
        Modifies an entry in the directory.
        Parameters:
        dn - The DN of the entry to modify.
        mods - The modifications to apply to the entry.
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • read

        @NotNull
        public LDAPEntry read​(@NotNull
                              java.lang.String dn)
                       throws LDAPException
        Retrieves an entry from the directory server.
        Parameters:
        dn - The DN of the entry to retrieve.
        Returns:
        The entry that was read.
        Throws:
        LDAPException - If a problem occurs while performing the search.
      • read

        @NotNull
        public LDAPEntry read​(@NotNull
                              java.lang.String dn,
                              @Nullable
                              java.lang.String[] attrs)
                       throws LDAPException
        Retrieves an entry from the directory server.
        Parameters:
        dn - The DN of the entry to retrieve.
        attrs - The set of attributes to request.
        Returns:
        The entry that was read.
        Throws:
        LDAPException - If a problem occurs while performing the search.
      • read

        @NotNull
        public LDAPEntry read​(@NotNull
                              java.lang.String dn,
                              @Nullable
                              java.lang.String[] attrs,
                              @Nullable
                              LDAPSearchConstraints constraints)
                       throws LDAPException
        Retrieves an entry from the directory server.
        Parameters:
        dn - The DN of the entry to retrieve.
        attrs - The set of attributes to request.
        constraints - The constraints to use for the search operation.
        Returns:
        The entry that was read.
        Throws:
        LDAPException - If a problem occurs while performing the search.
      • rename

        public void rename​(@NotNull
                           java.lang.String dn,
                           @NotNull
                           java.lang.String newRDN,
                           boolean deleteOldRDN)
                    throws LDAPException
        Alters the DN of an entry in the directory.
        Parameters:
        dn - The DN of the entry to modify.
        newRDN - The new RDN to use for the entry.
        deleteOldRDN - Indicates whether to remove the old RDN value(s).
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • rename

        public void rename​(@NotNull
                           java.lang.String dn,
                           @NotNull
                           java.lang.String newRDN,
                           boolean deleteOldRDN,
                           @Nullable
                           LDAPConstraints constraints)
                    throws LDAPException
        Alters the DN of an entry in the directory.
        Parameters:
        dn - The DN of the entry to modify.
        newRDN - The new RDN to use for the entry.
        deleteOldRDN - Indicates whether to remove the old RDN value(s).
        constraints - The constraints to use for the modify operation.
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • rename

        public void rename​(@NotNull
                           java.lang.String dn,
                           @NotNull
                           java.lang.String newRDN,
                           @Nullable
                           java.lang.String newParentDN,
                           boolean deleteOldRDN)
                    throws LDAPException
        Alters the DN of an entry in the directory.
        Parameters:
        dn - The DN of the entry to modify.
        newRDN - The new RDN to use for the entry.
        newParentDN - The DN of the new parent, or null if it should not be moved below a new parent.
        deleteOldRDN - Indicates whether to remove the old RDN value(s).
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • rename

        public void rename​(@NotNull
                           java.lang.String dn,
                           @NotNull
                           java.lang.String newRDN,
                           @Nullable
                           java.lang.String newParentDN,
                           boolean deleteOldRDN,
                           @Nullable
                           LDAPConstraints constraints)
                    throws LDAPException
        Alters the DN of an entry in the directory.
        Parameters:
        dn - The DN of the entry to modify.
        newRDN - The new RDN to use for the entry.
        newParentDN - The DN of the new parent, or null if it should not be moved below a new parent.
        deleteOldRDN - Indicates whether to remove the old RDN value(s).
        constraints - The constraints to use for the modify operation.
        Throws:
        LDAPException - If a problem occurs while processing the delete.
      • search

        @NotNull
        public LDAPSearchResults search​(@NotNull
                                        java.lang.String baseDN,
                                        int scope,
                                        @NotNull
                                        java.lang.String filter,
                                        @Nullable
                                        java.lang.String[] attributes,
                                        boolean typesOnly)
                                 throws LDAPException
        Processes a search in the directory server.
        Parameters:
        baseDN - The base DN for the search.
        scope - The scope for the search.
        filter - The filter for the search.
        attributes - The set of attributes to request.
        typesOnly - Indicates whether to return attribute types only or both types and values.
        Returns:
        The entry that was read.
        Throws:
        LDAPException - If a problem occurs while performing the search.
      • search

        @NotNull
        public LDAPSearchResults search​(@NotNull
                                        java.lang.String baseDN,
                                        int scope,
                                        @NotNull
                                        java.lang.String filter,
                                        @Nullable
                                        java.lang.String[] attributes,
                                        boolean typesOnly,
                                        @Nullable
                                        LDAPSearchConstraints constraints)
                                 throws LDAPException
        Processes a search in the directory server.
        Parameters:
        baseDN - The base DN for the search.
        scope - The scope for the search.
        filter - The filter for the search.
        attributes - The set of attributes to request.
        typesOnly - Indicates whether to return attribute types only or both types and values.
        constraints - The constraints to use for the search operation.
        Returns:
        The entry that was read.
        Throws:
        LDAPException - If a problem occurs while performing the search.