Interface LDAPMessageFactory


  • public interface LDAPMessageFactory
    Represents a factory interface that provides methods for creating LDAP objects.
    • Method Detail

      • createAddRequest

        LDAPAddRequest createAddRequest​(String dn,
                                        LDAPAttribute... attributes)
                                 throws LDAPException
        Creates a new add request, which can be used to perform an LDAP add operation to create a new entry in the directory.
        Parameters:
        dn - the distinguished name for the add operation. It must not be null.
        attributes - the set of attributes for the add operation. It must not be null.
        Returns:
        a new add request, which can be used to perform an add operation for a given DN and set of attributes.
        Throws:
        LDAPException - if failed to create a valid add request for a given DN and set of attributes.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createAttribute

        LDAPAttribute createAttribute​(String attrName,
                                      String... values)
                               throws LDAPException
        Creates a new attribute, which can be used to create an LDAP add request. Note that the created attribute is immutable (that is, once created, it cannot be altered).
        Parameters:
        attrName - the name for this attribute. It must not be null.
        values - the set of values for this attribute. It must not be null.
        Returns:
        a new attribute, which can be used to create an LDAP add request.
        Throws:
        LDAPException - if failed to create a valid attribute for a given name and set of values.
        See Also:
        LDAPAddRequest
      • createAttribute

        LDAPAttribute createAttribute​(String attrName,
                                      byte[]... values)
                               throws LDAPException
        Creates a new attribute, which can be used to create an LDAP add request. Note that the created attribute is immutable (that is, once created, it cannot be altered).
        Parameters:
        attrName - the name for this attribute. It must not be null.
        values - the set of values for this attribute. It must not be null.
        Returns:
        a new attribute, which can be used to create an LDAP add request.
        Throws:
        LDAPException - if failed to create a valid attribute for a given name and set of values.
        See Also:
        LDAPAddRequest
      • createBindRequest

        LDAPBindRequest createBindRequest​(String bindDN,
                                          String password)
                                   throws LDAPException
        Creates a new bind request, which can be used to perform an LDAP simple bind operation, which authenticates using a bind DN and password.
        Parameters:
        bindDN - the distinguished name for the simple bind operation.
        password - the password for the simple bind operation.
        Returns:
        a new bind request, which can be used to perform a simple bind operation for a given bind DN and password.
        Throws:
        LDAPException - if failed to create a valid bind request for a given bind DN and password.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createCompareRequest

        LDAPCompareRequest createCompareRequest​(String dn,
                                                String attrName,
                                                String assertionValue)
                                         throws LDAPException
        Creates a new compare request, which can be used to perform an LDAP compare operation to determine whether a specified entry contains a given attribute value.
        Parameters:
        dn - the entry distinguished name for the compare operation. It must not be null.
        attrName - the name of the attribute for the compare operation. It must not be null.
        assertionValue - the assertion value for the compare operation. It must not be null.
        Returns:
        a new compare request, which can be used to perform a compare operation for a given DN, attribute name and assertion value.
        Throws:
        LDAPException - if failed to create a valid compare request for a given DN, attribute name and assertion value.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createCompareRequest

        LDAPCompareRequest createCompareRequest​(String dn,
                                                String attrName,
                                                byte[] assertionValue)
                                         throws LDAPException
        Creates a new compare request, which can be used to perform an LDAP compare operation to determine whether a specified entry contains a given attribute value.
        Parameters:
        dn - the entry distinguished name for the compare operation. It must not be null.
        attrName - the name of the attribute for the compare operation. It must not be null.
        assertionValue - the assertion value for the compare operation. It must not be null.
        Returns:
        a new compare request, which can be used to perform a compare operation for a given DN, attribute name and assertion value.
        Throws:
        LDAPException - if failed to create a valid compare request for a given DN, attribute name and assertion value.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createDeleteRequest

        LDAPDeleteRequest createDeleteRequest​(String dn)
                                       throws LDAPException
        Creates a new delete request, which can be used to perform an LDAP delete operation to remove an entry from the directory.
        Parameters:
        dn - the distinguished name for the delete operation. It must not be null.
        Returns:
        a new delete request, which can be used to perform a delete operation for a given DN.
        Throws:
        LDAPException - if failed to create a valid delete request for a given DN.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createModification

        LDAPModification createModification​(LDAPModificationType type,
                                            String attrName)
                                     throws LDAPException
        Creates a new modification, which can be used to create an LDAP modify request. Note that the created modification is immutable (that is, once created, it cannot be altered).
        Parameters:
        type - the modification type for this modification. It must not be null.
        attrName - the name of the attribute to target with this modification. It must not be null.
        Returns:
        a new modification, which can be used to create an LDAP modify request.
        Throws:
        LDAPException - if failed to create a valid modification for a given type and attribute name.
        See Also:
        LDAPModifyRequest
      • createModification

        LDAPModification createModification​(LDAPModificationType type,
                                            String attrName,
                                            String... values)
                                     throws LDAPException
        Creates a new modification, which can be used to create an LDAP modify request. Note that the created modification is immutable (that is, once created, it cannot be altered).
        Parameters:
        type - the modification type for this modification. It must not be null.
        attrName - the name of the attribute to target with this modification. It must not be null.
        values - the set of attribute values for this modification. It must not be null.
        Returns:
        a new modification, which can be used to create an LDAP modify request.
        Throws:
        LDAPException - if failed to create a valid modification for a given type, attribute name and values.
        See Also:
        LDAPModifyRequest
      • createModification

        LDAPModification createModification​(LDAPModificationType type,
                                            String attrName,
                                            byte[]... values)
                                     throws LDAPException
        Creates a new modification, which can be used to create an LDAP modify request. Note that the created modification is immutable (that is, once created, it cannot be altered).
        Parameters:
        type - the modification type for this modification. It must not be null.
        attrName - the name of the attribute to target with this modification. It must not be null.
        values - the set of attribute values for this modification. It must not be null.
        Returns:
        a new modification, which can be used to create an LDAP modify request.
        Throws:
        LDAPException - if failed to create a valid modification for a given type, attribute name and values.
        See Also:
        LDAPModifyRequest
      • createModifyRequest

        LDAPModifyRequest createModifyRequest​(String dn,
                                              LDAPModification... modifications)
                                       throws LDAPException
        Creates a new modify request, which can be used to perform an LDAP modify operation to update an entry in the directory.
        Parameters:
        dn - the distinguished name for the modify operation. It must not be null.
        modifications - the set of modifications to apply to the entry. It must not be null.
        Returns:
        a new modify request, which can be used to perform a modify operation for a given DN and set of modifications.
        Throws:
        LDAPException - if failed to create a valid modify request for a given DN and set of modifications.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createModifyDNRequest

        LDAPModifyDNRequest createModifyDNRequest​(String dn,
                                                  String newRDN,
                                                  boolean deleteOldRDN)
                                           throws LDAPException
        Creates a new modify DN request, which can be used to perform an LDAP modify DN operation to rename and/or move an entry or subtree in the directory.
        Parameters:
        dn - the entry distinguished name for the modify DN operation. It must not be null.
        newRDN - the new relative distinguished name for the modify DN operation. It must not be null.
        deleteOldRDN - specifies whether the old relative distinguished name value should be removed from the entry.
        Returns:
        a new modify DN request, which can be used to perform a modify DN operation for a given DN, newRDN and deleteOldRDN indicator.
        Throws:
        LDAPException - if failed to create a valid modify DN request for a given DN, newRDN and deleteOldRDN indicator.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createModifyDNRequest

        LDAPModifyDNRequest createModifyDNRequest​(String dn,
                                                  String newRDN,
                                                  boolean deleteOldRDN,
                                                  String newSuperiorDN)
                                           throws LDAPException
        Creates a new modify DN request, which can be used to perform an LDAP modify DN operation to rename and/or move an entry or subtree in the directory.
        Parameters:
        dn - the entry distinguished name for the modify DN operation. It must not be null.
        newRDN - the new relative distinguished name for the modify DN operation. It must not be null.
        deleteOldRDN - specifies whether the old relative distinguished name value should be removed from the entry.
        newSuperiorDN - the new superior distinguished name for the modify DN operation.
        Returns:
        a new modify DN request, which can be used to perform a modify DN operation for a given DN, newRDN, deleteOldRDN indicator and newSuperiorDN.
        Throws:
        LDAPException - if failed to create a valid modify DN request for a given DN, newRDN, deleteOldRDN indicator and newSuperiorDN.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)
      • createSearchRequest

        LDAPSearchRequest createSearchRequest​(String base,
                                              LDAPSearchScope scope,
                                              String filter,
                                              String... attributes)
                                       throws LDAPException
        Creates a new search request, which can be used to perform an LDAP search operation to retrieve entries that match a given set of criteria.
        Parameters:
        base - the base distinguished name from which to search. It must not be null.
        scope - the scope of the entries to search. It must not be null.
        filter - the search filter specifying the search criteria. It must not be null.
        attributes - the list of attributes to return in the search results.
        Returns:
        a new search request, which can be used to perform a search operation for a given set of criteria.
        Throws:
        LDAPException - if failed to create a valid search request for a given set of criteria.
        See Also:
        LDAPProvider.sendRequest(LDAPRequest)