Package org.ldaptive

Class DnParser


  • @Deprecated
    public final class DnParser
    extends Object
    Deprecated.
    Use an implementation of DnParser
    Parses DNs following the rules in RFC 4514. Attempts to be as generous as possible in the format of allowed DNs.
    • Field Detail

      • LOGGER

        private static final Logger LOGGER
        Deprecated.
        Logger for this class.
      • HEX_RADIX

        private static final int HEX_RADIX
        Deprecated.
        Hexadecimal radix.
        See Also:
        Constant Field Values
      • HEX_PATH

        private static final DERPath HEX_PATH
        Deprecated.
        DER path for hex values.
    • Constructor Detail

      • DnParser

        private DnParser()
        Deprecated.
        Default constructor.
    • Method Detail

      • getValues

        public static Collection<String> getValues​(String dn,
                                                   String name)
        Deprecated.
        Returns the RDN values for the attribute type with the supplied name.
        Parameters:
        dn - to parse
        name - of the attribute type to return values for
        Returns:
        DN attribute values
      • getValue

        public static String getValue​(String dn,
                                      String name)
        Deprecated.
        Returns the RDN value for the attribute type with the supplied name. If the component has multiple values, the first one is returned.
        Parameters:
        dn - to parse
        name - of the attribute to return value for
        Returns:
        DN attribute value
      • substring

        public static String substring​(String dn,
                                       int beginIndex)
        Deprecated.
        Returns a string representation of the supplied DN beginning at the supplied index. The leftmost RDN component begins at index 0.
        Parameters:
        dn - to parse
        beginIndex - index of first RDN to include in the result in the range [0, N-1] where N is the number of elements in the DN
        Returns:
        DN from the supplied beginIndex
        Throws:
        IndexOutOfBoundsException - if beginIndex is less than 0 or greater than the number of RDNs
      • substring

        public static String substring​(String dn,
                                       int beginIndex,
                                       int endIndex)
        Deprecated.
        Returns a string representation of the supplied DN beginning at beginIndex (inclusive) and ending at endIndex (exclusive). The leftmost RDN component begins at index 0. Where n is the number of RDNs, both beginIndex and endIndex are on the range [0, N-1].
        Parameters:
        dn - to parse
        beginIndex - index of first RDN to include in the result in the range [0, N-2] where N is the number of elements in the DN
        endIndex - index of last RDN to include in the result in the range [1, N-1] where N is the number of elements in the RDN
        Returns:
        DN from beginIndex (inclusive) to endIndex (exclusive)
        Throws:
        IndexOutOfBoundsException - if beginIndex is less than 0, if beginIndex is greater than endIndex, or endIndex is greater than the number of RDNs
      • convertDnToAttributes

        public static List<LdapAttribute> convertDnToAttributes​(String dn)
        Deprecated.
        Parses the supplied DN and converts each RDN into a LdapAttribute.
        Parameters:
        dn - to parse
        Returns:
        list of ldap attributes for each RDN
      • decodeHexValue

        protected static byte[] decodeHexValue​(char[] value)
        Deprecated.
        Decodes the supplied hexadecimal value.
        Parameters:
        value - hex to decode
        Returns:
        decoded bytes
      • decodeStringValue

        protected static String decodeStringValue​(String value)
        Deprecated.
        Decodes the supplied string attribute value. Unescapes escaped characters. If escaped character is a hex value, it is decoded.
        Parameters:
        value - to decode
        Returns:
        decoded string
      • readToChar

        private static int readToChar​(String s,
                                      char[] chars,
                                      int pos)
        Deprecated.
        Reads the supplied string starting at the supplied position until one of the supplied characters is found. Characters escaped with '\' are ignored.
        Parameters:
        s - to read
        chars - to match
        pos - to start reading at
        Returns:
        string index that matched a character or the last index in the string