Package org.ldaptive.schema
Class SchemaUtils
java.lang.Object
org.ldaptive.schema.SchemaUtils
Provides utility methods for this package.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidencodeDescriptor(StringBuilder sb, String descr) Encodes the supplied descriptor.static StringformatDescriptors(String... descrs) Returns a formatted string to describe the supplied descriptors.static StringformatNumbers(int... numbers) Returns a formatted string to describe the supplied numbers.static StringformatOids(String... oids) Returns a formatted string to describe the supplied OIDs.static LdapEntrygetLdapEntry(ConnectionFactory factory, String dn, String filter, String... retAttrs) Searches for the supplied dn and returns its ldap entry.static String[]parseDescriptors(String descrs) Parses the supplied descriptors string and returns its contents as a string array.static int[]parseNumbers(String numbers) Parses the supplied number string and returns its contents as a string array.static String[]Parses the supplied OID string and returns its contents as a string array.static StringparseQDString(String value) Returns a string with any HEX escaped characters encoded.
-
Constructor Details
-
SchemaUtils
private SchemaUtils()Default constructor.
-
-
Method Details
-
parseDescriptors
Parses the supplied descriptors string and returns its contents as a string array. If the string contains a single quote it is assumed to be a multivalue descriptor of the form "'value1' 'value2' 'value3'". Otherwise, it is treated as a single value descriptor.- Parameters:
descrs- string to parse- Returns:
- array of descriptors
-
parseQDString
Returns a string with any HEX escaped characters encoded.- Parameters:
value- to parse- Returns:
- parsed value
-
parseOIDs
Parses the supplied OID string and returns its contents as a string array. If the string contains a dollar sign it is assumed to be a multivalue OID of the form "value1 $ value2 $ value3". Otherwise, it is treated as a single value OID.- Parameters:
oids- string to parse- Returns:
- array of oids
-
parseNumbers
Parses the supplied number string and returns its contents as a string array.- Parameters:
numbers- string to parse- Returns:
- array of numbers
-
formatDescriptors
Returns a formatted string to describe the supplied descriptors.- Parameters:
descrs- to format- Returns:
- formatted string
-
encodeDescriptor
Encodes the supplied descriptor. Hex encodes non-printable ASCII, including backslash and single quote.- Parameters:
sb- to append encoded descriptor todescr- to encode
-
formatOids
Returns a formatted string to describe the supplied OIDs.- Parameters:
oids- to format- Returns:
- formatted string
-
formatNumbers
Returns a formatted string to describe the supplied numbers.- Parameters:
numbers- to format- Returns:
- formatted string
-
getLdapEntry
public static LdapEntry getLdapEntry(ConnectionFactory factory, String dn, String filter, String... retAttrs) throws LdapException Searches for the supplied dn and returns its ldap entry.- Parameters:
factory- to obtain an LDAP connection fromdn- to search forfilter- search filterretAttrs- attributes to return- Returns:
- ldap entry
- Throws:
LdapException- if the search fails
-