Class SchemaUtils
java.lang.Object
org.apache.directory.api.ldap.model.schema.SchemaUtils
Various utility methods for schema functions and objects.
- Author:
- Apache Directory Project
-
Method Summary
Modifier and TypeMethodDescriptiongetOptions(String attributeId) Get the options from the attributeType.static EntrygetTargetEntry(List<? extends Modification> mods, Entry entry) Gets the target entry as it would look after a modification operation were performed on it.static booleanisAttributeNameValid(String attributeName) Tells if an AttributeType name is valid or not.static StringBuilderrender(StringBuilder buf, List<String> qdescrs) Renders qdescrs into an existing buffer.static StringBuilderrender(StringBuilder buf, AttributeType[] ats) Renders a list of attributeTypes for things like the must or may list of objectClasses using the ( oid $ oid ) format into an existing buffer.static StringBuilderrender(StringBuilder buf, ObjectClass[] ocs) Renders a list of object classes for things like a list of superior objectClasses using the ( oid $ oid ) format into an existing buffer.static StringBuilderRenders the schema extensions into a new StringBuffer.static StringBuilderrender(AttributeType[] ats) Renders a list of attributeTypes for things like the must or may list of objectClasses using the ( oid $ oid ) format.static Stringrender(LoadableSchemaObject description) Returns a String description of a schema.static StringBuilderrender(ObjectClass[] ocs) Renders a list of object classes for things like a list of superior objectClasses using the ( oid $ oid ) format.static StringstripOptions(String attributeId) Remove the options from the attributeType, and returns the ID.static byte[]uuidToBytes(UUID uuid) Transform an UUID in a byte array
-
Method Details
-
getTargetEntry
public static Entry getTargetEntry(List<? extends Modification> mods, Entry entry) throws LdapException Gets the target entry as it would look after a modification operation were performed on it.- Parameters:
mods- the modifications performed on the entryentry- the source entry that is modified- Returns:
- the resultant entry after the modifications have taken place
- Throws:
LdapException- if there are problems accessing attributes
-
render
Renders qdescrs into an existing buffer.- Parameters:
buf- the string buffer to render the quoted description strs intoqdescrs- the quoted description strings to render- Returns:
- the same string buffer that was given for call chaining
-
render
Renders a list of object classes for things like a list of superior objectClasses using the ( oid $ oid ) format.- Parameters:
ocs- the objectClasses to list- Returns:
- a buffer which contains the rendered list
-
render
Renders a list of object classes for things like a list of superior objectClasses using the ( oid $ oid ) format into an existing buffer.- Parameters:
buf- the string buffer to render the list of objectClasses intoocs- the objectClasses to list- Returns:
- a buffer which contains the rendered list
-
render
Renders a list of attributeTypes for things like the must or may list of objectClasses using the ( oid $ oid ) format.- Parameters:
ats- the attributeTypes to list- Returns:
- a buffer which contains the rendered list
-
render
Renders a list of attributeTypes for things like the must or may list of objectClasses using the ( oid $ oid ) format into an existing buffer.- Parameters:
buf- the string buffer to render the list of attributeTypes intoats- the attributeTypes to list- Returns:
- a buffer which contains the rendered list
-
render
Renders the schema extensions into a new StringBuffer.- Parameters:
extensions- the schema extensions map with key and values- Returns:
- a StringBuffer with the extensions component of a syntax description
-
render
Returns a String description of a schema. The resulting String format is :
(OID [DESC '<description>'] FQCN <fcqn> [BYTECODE <bytecode>] X-SCHEMA '<schema>')- Parameters:
description- The description to transform to a String- Returns:
- The rendered schema object
-
stripOptions
Remove the options from the attributeType, and returns the ID.
RFC 4512 :attributedescription = attributetype options attributetype = oid options = *( SEMI option ) option = 1*keychar
- Parameters:
attributeId- The AttributeType to parse- Returns:
- The AttributeType without its options
-
getOptions
Get the options from the attributeType.
For instance, given : jpegphoto;binary;lang=jp
your get back a set containing { "binary", "lang=jp" }- Parameters:
attributeId- The AttributeType to parse- Returns:
- a Set of options found for this AttributeType, or null
-
uuidToBytes
Transform an UUID in a byte array- Parameters:
uuid- The UUID to transform- Returns:
- The byte[] representing the UUID
-
isAttributeNameValid
Tells if an AttributeType name is valid or not. An Attribute name is valid if it's a descr / numericoid, as described in rfc4512 :name = descr / numericOid descr = keystring keystring = leadkeychar *keychar leadkeychar = ALPHA keychar = ALPHA / DIGIT / HYPHEN / USCORE numericoid = number 1*( DOT number ) number = DIGIT / ( LDIGIT 1*DIGIT ) ALPHA = %x41-5A / %x61-7A ; "A"-"Z" / "a"-"z" DIGIT = %x30 / LDIGIT ; "0"-"9" HYPHEN = %x2D ; hyphen ("-") LDIGIT = %x31-39 ; "1"-"9" DOT = %x2E ; period (".") USCORE = %x5F ; underscore ("_")Note that we have extended this grammar to accept the '_' char, which is widely used in teh LDAP world.- Parameters:
attributeName- The AttributeType name to check- Returns:
- true if it's valid
-