T - The type of SchemaObjectpublic abstract class AbstractSchemaParser<T extends SchemaObject> extends Object
| Modifier and Type | Field and Description |
|---|---|
private org.apache.directory.api.i18n.I18n |
errorCodeOnNull
error code used when schema descritpion is null
|
private org.apache.directory.api.i18n.I18n |
errorCodeOnParseException
error code used on parse error when position is unknown
|
private org.apache.directory.api.i18n.I18n |
errorCodeOnParseExceptionWithPosition
error code used on parse error when position is known
|
protected ReusableAntlrSchemaLexer |
lexer
the antlr generated lexer being wrapped
|
protected static org.slf4j.Logger |
LOG
The LoggerFactory used by this class
|
protected ParserMonitor |
monitor
the monitor to use for this parser
|
protected ReusableAntlrSchemaParser |
parser
the antlr generated parser being wrapped
|
private Class<T> |
schemaObjectType
the schema object sub-type
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSchemaParser(Class<T> schemaObjectType,
org.apache.directory.api.i18n.I18n errorCodeOnNull,
org.apache.directory.api.i18n.I18n errorCodeOnParseExceptionWithPosition,
org.apache.directory.api.i18n.I18n errorCodeOnParseException)
Instantiates a new abstract schema parser.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
doParse()
Parse a SchemaObject description and returns back an instance of SchemaObject.
|
boolean |
isQuirksMode()
Checks if quirks mode is enabled.
|
T |
parse(String schemaDescription)
Parse a SchemaObject description and returns back an instance of SchemaObject.
|
protected void |
reset(String spec)
Initializes the plumbing by creating a pipe and coupling the parser/lexer
pair with it.
|
void |
setParserMonitor(ParserMonitor parserMonitor)
Sets the parser monitor.
|
void |
setQuirksMode(boolean enabled)
Sets the quirks mode.
|
private void |
updateSchemaName(SchemaObject schemaObject)
Update the schemaName for the given SchemaObject, accordingly to the X-SCHEMA parameter.
|
private ParseException |
wrapRecognitionException(String schemaDescription,
antlr.RecognitionException re) |
private ParseException |
wrapTokenStreamException(String schemaDescription,
antlr.TokenStreamException tse) |
protected static final org.slf4j.Logger LOG
protected ParserMonitor monitor
protected ReusableAntlrSchemaParser parser
protected ReusableAntlrSchemaLexer lexer
private Class<T extends SchemaObject> schemaObjectType
private org.apache.directory.api.i18n.I18n errorCodeOnNull
private org.apache.directory.api.i18n.I18n errorCodeOnParseExceptionWithPosition
private org.apache.directory.api.i18n.I18n errorCodeOnParseException
protected AbstractSchemaParser(Class<T> schemaObjectType, org.apache.directory.api.i18n.I18n errorCodeOnNull, org.apache.directory.api.i18n.I18n errorCodeOnParseExceptionWithPosition, org.apache.directory.api.i18n.I18n errorCodeOnParseException)
schemaObjectType - The Schema object typeerrorCodeOnNull - error code used when schema element is nullerrorCodeOnParseExceptionWithPosition - error code used on parse error when position is knownerrorCodeOnParseException - error code used on parse error when position is unknownprotected void reset(String spec)
spec - the specpublic void setParserMonitor(ParserMonitor parserMonitor)
parserMonitor - the new parser monitorpublic void setQuirksMode(boolean enabled)
enabled - the new quirks modepublic boolean isQuirksMode()
public T parse(String schemaDescription) throws ParseException
schemaDescription - The SchemaObject descriptionParseException - If the parsing failedprivate ParseException wrapRecognitionException(String schemaDescription, antlr.RecognitionException re)
private ParseException wrapTokenStreamException(String schemaDescription, antlr.TokenStreamException tse)
protected abstract T doParse() throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException - the native antlr exceptionantlr.TokenStreamException - the native antlr exceptionprivate void updateSchemaName(SchemaObject schemaObject)
schemaObject - the schema object where the name should be updatedCopyright © 2003–2017 The Apache Software Foundation. All rights reserved.