Class SchemaObjectRenderer
- java.lang.Object
-
- org.apache.directory.api.ldap.model.schema.SchemaObjectRenderer
-
public final class SchemaObjectRenderer extends Object
Renderer for schema objects. Currently the following preconfigured renderers exist:-
SUBSCHEMA_SUBENTRY_RENDERER: renders the schema object without line break and with X-SCHEMA extension. To be used for building subschema subentry. -
OPEN_LDAP_SCHEMA_RENDERER: renders the schema object in OpenLDAP schema format. That means is starts with schema type and contains line breaks for easier readability.
TODO: currently only
ObjectClassandAttributeTypeare supported, implement other schema object types.- Author:
- Apache Directory Project
-
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSchemaObjectRenderer.Style
-
Field Summary
Fields Modifier and Type Field Description static SchemaObjectRendererOPEN_LDAP_SCHEMA_RENDERERPreconfiguredSchemaObjectRendererthat renders the schema object in OpenLDAP schema format.private SchemaObjectRenderer.Stylestylestatic SchemaObjectRendererSUBSCHEMA_SUBENTRY_RENDERERPreconfiguredSchemaObjectRendererthat renders the schema object without line break and with X-SCHEMA extension.
-
Constructor Summary
Constructors Modifier Constructor Description privateSchemaObjectRenderer(SchemaObjectRenderer.Style style)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidprettyPrintIndent(StringBuilder buf)private voidprettyPrintNewLine(StringBuilder buf)Stringrender(AttributeType at)Renders an attributeType according to the Attribute Type Description Syntax 1.3.6.1.4.1.1466.115.121.1.3.Stringrender(DitContentRule dcr)NOT FULLY IMPLEMENTED!Stringrender(DitStructureRule dsr)NOT FULLY IMPLEMENTED!Stringrender(LdapSyntax syntax)Renders a Syntax according to the LDAP Syntax Description Syntax 1.3.6.1.4.1.1466.115.121.1.54.Stringrender(MatchingRule mr)Renders an matchingRule according to the MatchingRule Description Syntax 1.3.6.1.4.1.1466.115.121.1.30.Stringrender(MatchingRuleUse mru)NOT FULLY IMPLEMENTED!Stringrender(NameForm nf)NOT FULLY IMPLEMENTED!Stringrender(ObjectClass oc)Renders an objectClass according to the Object Class Description Syntax 1.3.6.1.4.1.1466.115.121.1.37.private voidrenderClose(StringBuilder buf)private voidrenderDescription(SchemaObject so, StringBuilder buf)private voidrenderNames(SchemaObject so, StringBuilder buf)private voidrenderObsolete(SchemaObject so, StringBuilder buf)private voidrenderOids(StringBuilder buf, String prefix, List<String> oids)private StringBuilderrenderOids(StringBuilder buf, List<String> oids)Renders oids into a new buffer.private StringBuilderrenderQDescrs(StringBuilder buf, List<String> qdescrs)Renders qdescrs into a new buffer.private StringBuilderrenderQDString(StringBuilder buf, String qdString)Renders QDString into a new buffer.private StringBuilderrenderRuleIds(StringBuilder buf, List<Integer> ruleIds)private StringBuilderrenderStartOidNamesDescObsolete(SchemaObject so, String schemaObjectType)private voidrenderXSchemaName(SchemaObject oc, StringBuilder buf)
-
-
-
Field Detail
-
SUBSCHEMA_SUBENTRY_RENDERER
public static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER
PreconfiguredSchemaObjectRendererthat renders the schema object without line break and with X-SCHEMA extension. To be used for building subschema subentry.
-
OPEN_LDAP_SCHEMA_RENDERER
public static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER
PreconfiguredSchemaObjectRendererthat renders the schema object in OpenLDAP schema format. That means is starts with schema type and contains line breaks for easier readability.
-
style
private final SchemaObjectRenderer.Style style
-
-
Constructor Detail
-
SchemaObjectRenderer
private SchemaObjectRenderer(SchemaObjectRenderer.Style style)
-
-
Method Detail
-
render
public String render(ObjectClass oc)
Renders an objectClass according to the Object Class Description Syntax 1.3.6.1.4.1.1466.115.121.1.37. The syntax is described in detail within section 4.1.1. of RFC 4512 which is replicated here for convenience:4.1.1. Object Class Definitions Object Class definitions are written according to the ABNF: ObjectClassDescription = LPAREN WSP numericoid ; object identifier [ SP "NAME" SP qdescrs ] ; short names (descriptors) [ SP "DESC" SP qdstring ] ; description [ SP "OBSOLETE" ] ; not active [ SP "SUP" SP oids ] ; superior object classes [ SP kind ] ; kind of class [ SP "MUST" SP oids ] ; attribute types [ SP "MAY" SP oids ] ; attribute types extensions WSP RPAREN kind = "ABSTRACT" / "STRUCTURAL" / "AUXILIARY" where: <numericoid> is object identifier assigned to this object class; NAME <qdescrs> are short names (descriptors) identifying this object class; DESC <qdstring> is a short descriptive string; OBSOLETE indicates this object class is not active; SUP <oids> specifies the direct superclasses of this object class; the kind of object class is indicated by one of ABSTRACT, STRUCTURAL, or AUXILIARY, default is STRUCTURAL; MUST and MAY specify the sets of required and allowed attribute types, respectively; and <extensions> describe extensions.- Parameters:
oc- the ObjectClass to render the description of- Returns:
- the string form of the Object Class description
-
render
public String render(AttributeType at)
Renders an attributeType according to the Attribute Type Description Syntax 1.3.6.1.4.1.1466.115.121.1.3. The syntax is described in detail within section 4.1.2. of RFC 4512 which is replicated here for convenience:4.1.2. Attribute Types Attribute Type definitions are written according to the ABNF: AttributeTypeDescription = LPAREN WSP numericoid ; object identifier [ SP "NAME" SP qdescrs ] ; short names (descriptors) [ SP "DESC" SP qdstring ] ; description [ SP "OBSOLETE" ] ; not active [ SP "SUP" SP oid ] ; supertype [ SP "EQUALITY" SP oid ] ; equality matching rule [ SP "ORDERING" SP oid ] ; ordering matching rule [ SP "SUBSTR" SP oid ] ; substrings matching rule [ SP "SYNTAX" SP noidlen ] ; value syntax [ SP "SINGLE-VALUE" ] ; single-value [ SP "COLLECTIVE" ] ; collective [ SP "NO-USER-MODIFICATION" ] ; not user modifiable [ SP "USAGE" SP usage ] ; usage extensions WSP RPAREN ; extensions usage = "userApplications" / ; user "directoryOperation" / ; directory operational "distributedOperation" / ; DSA-shared operational "dSAOperation" ; DSA-specific operational where: <numericoid> is object identifier assigned to this attribute type; NAME <qdescrs> are short names (descriptors) identifying this attribute type; DESC <qdstring> is a short descriptive string; OBSOLETE indicates this attribute type is not active; SUP oid specifies the direct supertype of this type; EQUALITY, ORDERING, SUBSTR provide the oid of the equality, ordering, and substrings matching rules, respectively; SYNTAX identifies value syntax by object identifier and may suggest a minimum upper bound; SINGLE-VALUE indicates attributes of this type are restricted to a single value; COLLECTIVE indicates this attribute type is collective [X.501][RFC3671]; NO-USER-MODIFICATION indicates this attribute type is not user modifiable; USAGE indicates the application of this attribute type; and <extensions> describe extensions.- Parameters:
at- the AttributeType to render the description for- Returns:
- the StringBuffer containing the rendered attributeType description
-
render
public String render(MatchingRule mr)
Renders an matchingRule according to the MatchingRule Description Syntax 1.3.6.1.4.1.1466.115.121.1.30. The syntax is described in detail within section 4.1.3. RFC 4512 which is replicated here for convenience:4.1.3. Matching Rules Matching rules are used in performance of attribute value assertions, such as in performance of a Compare operation. They are also used in evaluation of a Search filters, in determining which individual values are be added or deleted during performance of a Modify operation, and used in comparison of distinguished names. Each matching rule is identified by an object identifier (OID) and, optionally, one or more short names (descriptors). Matching rule definitions are written according to the ABNF: MatchingRuleDescription = LPAREN WSP numericoid ; object identifier [ SP "NAME" SP qdescrs ] ; short names (descriptors) [ SP "DESC" SP qdstring ] ; description [ SP "OBSOLETE" ] ; not active SP "SYNTAX" SP numericoid ; assertion syntax extensions WSP RPAREN ; extensions where: <numericoid> is object identifier assigned to this matching rule; NAME <qdescrs> are short names (descriptors) identifying this matching rule; DESC <qdstring> is a short descriptive string; OBSOLETE indicates this matching rule is not active; SYNTAX identifies the assertion syntax (the syntax of the assertion value) by object identifier; and <extensions> describe extensions.- Parameters:
mr- the MatchingRule to render the description for- Returns:
- the StringBuffer containing the rendered matchingRule description
-
render
public String render(LdapSyntax syntax)
Renders a Syntax according to the LDAP Syntax Description Syntax 1.3.6.1.4.1.1466.115.121.1.54. The syntax is described in detail within section 4.1.5. of RFC 4512 which is replicated here for convenience:LDAP syntax definitions are written according to the ABNF: SyntaxDescription = LPAREN WSP numericoid ; object identifier [ SP "DESC" SP qdstring ] ; description extensions WSP RPAREN ; extensions where: <numericoid> is the object identifier assigned to this LDAP syntax; DESC <qdstring> is a short descriptive string; and <extensions> describe extensions.- Parameters:
syntax- the Syntax to render the description for- Returns:
- the StringBuffer containing the rendered syntax description
-
render
public String render(MatchingRuleUse mru)
NOT FULLY IMPLEMENTED! Renders a MatchingRuleUse as a String- Parameters:
mru- The MatchingRuleUse to render- Returns:
- The MatchingRuleUse as a String
-
render
public String render(DitContentRule dcr)
NOT FULLY IMPLEMENTED! Renders a DitContentRule as a String- Parameters:
dcr- The DitContentRule to render- Returns:
- The DitContentRule as a String
-
render
public String render(DitStructureRule dsr)
NOT FULLY IMPLEMENTED!- Parameters:
dsr- The DitStructureRule to render- Returns:
- The DitStructureRule as a String
-
render
public String render(NameForm nf)
NOT FULLY IMPLEMENTED! Render a NameForm as a String- Parameters:
nf- The NameForm to render- Returns:
- The rendered String
-
renderStartOidNamesDescObsolete
private StringBuilder renderStartOidNamesDescObsolete(SchemaObject so, String schemaObjectType)
-
renderNames
private void renderNames(SchemaObject so, StringBuilder buf)
-
renderDescription
private void renderDescription(SchemaObject so, StringBuilder buf)
-
renderObsolete
private void renderObsolete(SchemaObject so, StringBuilder buf)
-
prettyPrintNewLine
private void prettyPrintNewLine(StringBuilder buf)
-
prettyPrintIndent
private void prettyPrintIndent(StringBuilder buf)
-
renderQDescrs
private StringBuilder renderQDescrs(StringBuilder buf, List<String> qdescrs)
Renders qdescrs into a new buffer.
descrs ::= qdescr | '(' WSP qdescrlist WSP ')' qdescrlist ::= [ qdescr ( SP qdescr )* ] qdescr ::= SQUOTE descr SQUOTE- Parameters:
buf- The buffer that will contain the result.qdescrs- the quoted description strings to render- Returns:
- the string buffer the qdescrs are rendered into
-
renderOids
private void renderOids(StringBuilder buf, String prefix, List<String> oids)
-
renderOids
private StringBuilder renderOids(StringBuilder buf, List<String> oids)
Renders oids into a new buffer.
oids ::= oid | '(' WSP oidlist WSP ')' oidlist ::= oid ( WSP '$' WSP oid )*- Parameters:
buf- The resulting bufferoids- the list of OIDs to render- Returns:
- the string buffer the qdescrs are rendered into
-
renderQDString
private StringBuilder renderQDString(StringBuilder buf, String qdString)
Renders QDString into a new buffer.- Parameters:
buf- The resulting bufferqdString- the quoted description strings to render- Returns:
- the string buffer the qdescrs are rendered into
-
renderRuleIds
private StringBuilder renderRuleIds(StringBuilder buf, List<Integer> ruleIds)
-
renderXSchemaName
private void renderXSchemaName(SchemaObject oc, StringBuilder buf)
-
renderClose
private void renderClose(StringBuilder buf)
-
-