Package liquibase.parser
Class AbstractFormattedChangeLogParser
java.lang.Object
liquibase.parser.AbstractFormattedChangeLogParser
- All Implemented Interfaces:
ChangeLogParser
,LiquibaseParser
,PrioritizedService
- Direct Known Subclasses:
FormattedSqlChangeLogParser
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
static final String
static final String
static final String
static final String
protected final Pattern
protected final String
protected final Pattern
protected final String
static final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
protected static final String
static final String
protected final Pattern
protected static final String
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected final String
protected final Pattern
protected static final String
static final String
static final String
protected final Pattern
protected final String
protected final Pattern
protected static final String
protected final Pattern
protected final String
static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected final String
protected final Pattern
protected final String
static final String
static final String
static final String
protected final Pattern
protected final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected static final String
static final String
protected final Pattern
protected static final String
static final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern
protected final String
protected final Pattern
protected static final String
protected final Pattern
protected static final String
protected final Pattern[]
protected static final String
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureChangeSet
(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher) Deprecated.protected void
configureChangeSet
(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher, ResourceAccessor resourceAccessor) protected void
configureChangeSet
(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher, ResourceAccessor resourceAccessor, DatabaseChangeLog changeLog, AbstractSQLChange change, Matcher rollbackSplitStatementsMatcher, boolean rollbackSplitStatements, String rollbackEndDelimiter, AtomicBoolean changeSetFinished) Configure the change set with its attributes.protected ChangeSet
configureChangeSet
(DatabaseChangeLog changeLog, boolean runOnChange, boolean runAlways, boolean runInTransaction, boolean failOnError, String runWith, String runWithSpoolFile, String context, String labels, String logicalFilePath, String dbms, String ignore, String changeSetId, String changeSetAuthor) protected abstract AbstractSQLChange
protected abstract String
protected abstract String
int
protected abstract String
protected abstract String
protected abstract String
protected abstract String
protected boolean
handleAdditionalLines
(DatabaseChangeLog changeLog, ResourceAccessor resourceAccessor, String line) protected void
handleChangeSet
(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ChangeSet changeSet, StringBuilder currentSequence, AbstractSQLChange change, DatabaseChangeLog changeLog, StringBuilder currentRollbackSequence, Matcher rollbackSplitStatementsPatternMatcher, boolean rollbackSplitStatements, String rollbackEndDelimiter) protected String
handleDbms
(ChangeLogParameters changeLogParameters, String line, DatabaseChangeLog changeLog) protected void
handleEndDelimiter
(String line, AbstractSQLChange change) protected void
handleInvalidEmptyPreconditionCase
(ChangeLogParameters changeLogParameters, ChangeSet changeSet, Matcher preconditionMatcher) protected abstract void
handlePreconditionCase
(ChangeLogParameters changeLogParameters, ChangeSet changeSet, Matcher preconditionMatcher) protected abstract void
handlePreconditionsCase
(ChangeSet changeSet, int count, Matcher preconditionsMatcher) protected void
handleSplitStatements
(String line, ChangeSet changeSet, AbstractSQLChange change) protected void
handleStripComments
(String line, ChangeSet changeSet, AbstractSQLChange change) protected abstract boolean
isNotEndDelimiter
(AbstractSQLChange change) protected void
logMatch
(String attribute, String value, Class<? extends AbstractFormattedChangeLogParser> clazz) protected InputStream
openChangeLogFile
(String physicalChangeLogLocation, ResourceAccessor resourceAccessor) parse
(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor) Parses a Liquibase database changelog and returns the parsed form as an object.protected boolean
parseBoolean
(Matcher matcher, ChangeSet changeSet, boolean defaultValue) protected boolean
parseBoolean
(Matcher matcher, ChangeSet changeSet, boolean defaultValue, String description) protected String
parseString
(Matcher matcher, String description) protected static void
resetSequences
(StringBuilder currentSequence, StringBuilder currentRollbackSequence) protected abstract void
setChangeSequence
(AbstractSQLChange change, String finalCurrentSequence) protected abstract void
setChangeSequence
(ChangeLogParameters changeLogParameters, StringBuilder currentSequence, ChangeSet changeSet, AbstractSQLChange change) protected void
setLogicalFilePath
(DatabaseChangeLog changeLog, String line, Matcher changeLogPatterMatcher) boolean
supports
(String changeLogFile, ResourceAccessor resourceAccessor) Checks if the file format is supported by an implementing ChangeLogParser and returns true if that is the case.protected abstract boolean
supportsExtension
(String changelogFile)
-
Field Details
-
EXCEPTION_MESSAGE
-
RUN_WITH
- See Also:
-
RUN_WITH_SPOOL_FILE
- See Also:
-
ROLLBACK_END_DELIMITER
- See Also:
-
CONTEXT
- See Also:
-
CONTEXT_FILTER
- See Also:
-
LABELS
- See Also:
-
LOGICAL_FILE_PATH
- See Also:
-
IGNORE
- See Also:
-
STRIP_COMMENTS
- See Also:
-
END_DELIMITER
- See Also:
-
DBMS
- See Also:
-
SPLIT_STATEMENTS
- See Also:
-
AUTHOR
- See Also:
-
ID
- See Also:
-
CHANGE_SET_PATH
- See Also:
-
PROPERTY_NAME
- See Also:
-
PROPERTY_VALUE
- See Also:
-
PROPERTY_CONTEXT_FILTER
- See Also:
-
PROPERTY_CONTEXT
- See Also:
-
CHANGE_SET_ID
- See Also:
-
CHANGE_SET_AUTHOR
- See Also:
-
FIRST_LINE_REGEX
-
FIRST_LINE_PATTERN
-
PROPERTY_REGEX
-
PROPERTY_PATTERN
-
ALT_PROPERTY_ONE_CHARACTER_REGEX
-
ALT_PROPERTY_ONE_CHARACTER_PATTERN
-
CHANGE_SET_REGEX
-
CHANGE_SET_PATTERN
-
ALT_CHANGE_SET_ONE_CHARACTER_REGEX
-
ALT_CHANGE_SET_ONE_CHARACTER_PATTERN
-
ALT_CHANGE_SET_NO_OTHER_INFO_REGEX
-
ALT_CHANGE_SET_NO_OTHER_INFO_PATTERN
-
ROLLBACK_REGEX
-
ROLLBACK_PATTERN
-
ALT_ROLLBACK_ONE_CHARACTER_REGEX
-
ALT_ROLLBACK_ONE_CHARACTER_PATTERN
-
PRECONDITIONS_REGEX
-
PRECONDITIONS_PATTERN
-
ALT_PRECONDITIONS_ONE_CHARACTER_REGEX
-
ALT_PRECONDITIONS_ONE_CHARACTER_PATTERN
-
PRECONDITION_REGEX
-
PRECONDITION_PATTERN
-
INVALID_EMPTY_PRECONDITION_REGEX
-
INVALID_EMPTY_PRECONDITION_PATTERN
-
ALT_PRECONDITION_ONE_CHARACTER_REGEX
-
ALT_PRECONDITION_ONE_CHARACTER_PATTERN
-
STRIP_COMMENTS_REGEX
- See Also:
-
STRIP_COMMENTS_PATTERN
-
SPLIT_STATEMENTS_REGEX
- See Also:
-
SPLIT_STATEMENTS_PATTERN
-
ROLLBACK_SPLIT_STATEMENTS_REGEX
- See Also:
-
ROLLBACK_SPLIT_STATEMENTS_PATTERN
-
END_DELIMITER_REGEX
- See Also:
-
END_DELIMITER_PATTERN
-
ROLLBACK_END_DELIMITER_REGEX
- See Also:
-
ROLLBACK_END_DELIMITER_PATTERN
-
COMMENT_REGEX
-
COMMENT_PATTERN
-
ALT_COMMENT_PLURAL_REGEX
-
ALT_COMMENT_PLURAL_PATTERN
-
ALT_COMMENT_ONE_CHARACTER_REGEX
-
ALT_COMMENT_ONE_CHARACTER_PATTERN
-
VALID_CHECK_SUM_REGEX
-
VALID_CHECK_SUM_PATTERN
-
ALT_VALID_CHECK_SUM_ONE_CHARACTER_REGEX
-
ALT_VALID_CHECK_SUM_ONE_CHARACTER_PATTERN
-
IGNORE_LINES_REGEX
-
IGNORE_LINES_PATTERN
-
ALT_IGNORE_LINES_ONE_CHARACTER_REGEX
-
ALT_IGNORE_LINES_ONE_CHARACTER_PATTERN
-
ALT_IGNORE_REGEX
-
ALT_IGNORE_PATTERN
-
RUN_WITH_REGEX
- See Also:
-
RUN_WITH_PATTERN
-
RUN_WITH_SPOOL_FILE_REGEX
- See Also:
-
RUN_WITH_SPOOL_FILE_PATTERN
-
RUN_ON_CHANGE_REGEX
- See Also:
-
RUN_ON_CHANGE_PATTERN
-
RUN_ALWAYS_REGEX
- See Also:
-
RUN_ALWAYS_PATTERN
-
CONTEXT_REGEX
- See Also:
-
CONTEXT_PATTERN
-
CONTEXT_FILTER_REGEX
- See Also:
-
CONTEXT_FILTER_PATTERN
-
LOGICAL_FILE_PATH_REGEX
- See Also:
-
LOGICAL_FILE_PATH_PATTERN
-
LABELS_REGEX
- See Also:
-
LABELS_PATTERN
-
RUN_IN_TRANSACTION_REGEX
- See Also:
-
RUN_IN_TRANSACTION_PATTERN
-
DBMS_REGEX
- See Also:
-
DBMS_PATTERN
-
IGNORE_REGEX
- See Also:
-
IGNORE_PATTERN
-
FAIL_ON_ERROR_REGEX
- See Also:
-
FAIL_ON_ERROR_PATTERN
-
ON_FAIL_REGEX
- See Also:
-
ON_FAIL_PATTERN
-
ON_ERROR_REGEX
- See Also:
-
ON_ERROR_PATTERN
-
ROLLBACK_CHANGE_SET_ID_REGEX
- See Also:
-
ROLLBACK_CHANGE_SET_ID_PATTERN
-
ROLLBACK_CHANGE_SET_AUTHOR_REGEX
- See Also:
-
ROLLBACK_CHANGE_SET_AUTHOR_PATTERN
-
ROLLBACK_CHANGE_SET_PATH_REGEX
- See Also:
-
ROLLBACK_CHANGE_SET_PATH_PATTERN
-
ROLLBACK_MULTI_LINE_START_REGEX
-
ROLLBACK_MULTI_LINE_START_PATTERN
-
ROLLBACK_MULTI_LINE_END_REGEX
-
ROLLBACK_MULTI_LINE_END_PATTERN
-
WORD_RESULT_REGEX
- See Also:
-
SINGLE_QUOTE_RESULT_REGEX
- See Also:
-
DOUBLE_QUOTE_RESULT_REGEX
- See Also:
-
WORD_AND_QUOTING_PATTERNS
-
NAME_REGEX
- See Also:
-
NAME_PATTERN
-
VALUE_REGEX
- See Also:
-
VALUE_PATTERN
-
GLOBAL_REGEX
- See Also:
-
GLOBAL_PATTERN
-
VIEW_NAME_STATEMENT_REGEX
- See Also:
-
VIEW_NAME_STATEMENT_PATTERN
-
TABLE_NAME_STATEMENT_REGEX
- See Also:
-
TABLE_NAME_STATEMENT_PATTERN
-
SCHEMA_NAME_STATEMENT_REGEX
- See Also:
-
SCHEMA_NAME_STATEMENT_PATTERN
-
-
Constructor Details
-
AbstractFormattedChangeLogParser
public AbstractFormattedChangeLogParser()
-
-
Method Details
-
getSingleLineCommentOneCharacter
-
getSingleLineCommentSequence
-
getStartMultiLineCommentSequence
-
getEndMultiLineCommentSequence
-
supportsExtension
-
handlePreconditionCase
protected abstract void handlePreconditionCase(ChangeLogParameters changeLogParameters, ChangeSet changeSet, Matcher preconditionMatcher) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
handlePreconditionsCase
protected abstract void handlePreconditionsCase(ChangeSet changeSet, int count, Matcher preconditionsMatcher) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
getChange
-
getDocumentationLink
-
getSequenceName
-
setChangeSequence
-
isNotEndDelimiter
-
setChangeSequence
protected abstract void setChangeSequence(ChangeLogParameters changeLogParameters, StringBuilder currentSequence, ChangeSet changeSet, AbstractSQLChange change) -
supports
Description copied from interface:ChangeLogParser
Checks if the file format is supported by an implementing ChangeLogParser and returns true if that is the case.- Specified by:
supports
in interfaceChangeLogParser
- Parameters:
changeLogFile
- the location of the changelog fileresourceAccessor
- the resource accessor- Returns:
- true if the file format is supported, false if it is not.
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfacePrioritizedService
-
parse
public DatabaseChangeLog parse(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor) throws ChangeLogParseException Description copied from interface:ChangeLogParser
Parses a Liquibase database changelog and returns the parsed form as an object.- Specified by:
parse
in interfaceChangeLogParser
- Parameters:
physicalChangeLogLocation
- the physical location of the changelog. The exact file formats and locations where can load changelog files from depend on the implementations and capabilities of the implementing parsers.changeLogParameters
- parameters given by the end user that should be applied while parsing the changelog (i.e. replacement of ${placeholders} inside the changelogs with user-defined content)resourceAccessor
- a Java resource accessor- Returns:
- the parsed ChangeLog in object form
- Throws:
ChangeLogParseException
- if an error occurs during parsing of the ChangeLog
-
handleChangeSet
protected void handleChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ChangeSet changeSet, StringBuilder currentSequence, AbstractSQLChange change, DatabaseChangeLog changeLog, StringBuilder currentRollbackSequence, Matcher rollbackSplitStatementsPatternMatcher, boolean rollbackSplitStatements, String rollbackEndDelimiter) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
handleStripComments
protected void handleStripComments(String line, ChangeSet changeSet, AbstractSQLChange change) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
handleEndDelimiter
-
handleDbms
protected String handleDbms(ChangeLogParameters changeLogParameters, String line, DatabaseChangeLog changeLog) -
handleSplitStatements
protected void handleSplitStatements(String line, ChangeSet changeSet, AbstractSQLChange change) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
configureChangeSet
@Deprecated protected void configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher) throws ChangeLogParseException, IOException Deprecated.- Throws:
ChangeLogParseException
IOException
-
configureChangeSet
protected void configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher, ResourceAccessor resourceAccessor) throws ChangeLogParseException, IOException - Throws:
ChangeLogParseException
IOException
-
configureChangeSet
protected void configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher, ResourceAccessor resourceAccessor, DatabaseChangeLog changeLog, AbstractSQLChange change, Matcher rollbackSplitStatementsMatcher, boolean rollbackSplitStatements, String rollbackEndDelimiter, AtomicBoolean changeSetFinished) throws ChangeLogParseException, IOException Configure the change set with its attributes. An changeSetFinished flag is available for override versions to indicate that processing is done for the change set- Parameters:
physicalChangeLogLocation
-changeLogParameters
-reader
-currentSequence
-currentRollbackSequence
-changeSet
-count
-line
-commentMatcher
-resourceAccessor
-changeLog
-change
-rollbackSplitStatementsMatcher
-rollbackSplitStatements
-rollbackEndDelimiter
-changeSetFinished
-- Throws:
ChangeLogParseException
IOException
-
configureChangeSet
protected ChangeSet configureChangeSet(DatabaseChangeLog changeLog, boolean runOnChange, boolean runAlways, boolean runInTransaction, boolean failOnError, String runWith, String runWithSpoolFile, String context, String labels, String logicalFilePath, String dbms, String ignore, String changeSetId, String changeSetAuthor) -
setLogicalFilePath
protected void setLogicalFilePath(DatabaseChangeLog changeLog, String line, Matcher changeLogPatterMatcher) -
parseString
-
openChangeLogFile
protected InputStream openChangeLogFile(String physicalChangeLogLocation, ResourceAccessor resourceAccessor) throws IOException - Throws:
IOException
-
handleInvalidEmptyPreconditionCase
protected void handleInvalidEmptyPreconditionCase(ChangeLogParameters changeLogParameters, ChangeSet changeSet, Matcher preconditionMatcher) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
resetSequences
protected static void resetSequences(StringBuilder currentSequence, StringBuilder currentRollbackSequence) -
handleAdditionalLines
protected boolean handleAdditionalLines(DatabaseChangeLog changeLog, ResourceAccessor resourceAccessor, String line) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
parseBoolean
protected boolean parseBoolean(Matcher matcher, ChangeSet changeSet, boolean defaultValue) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
parseBoolean
protected boolean parseBoolean(Matcher matcher, ChangeSet changeSet, boolean defaultValue, String description) throws ChangeLogParseException - Throws:
ChangeLogParseException
-
logMatch
protected void logMatch(String attribute, String value, Class<? extends AbstractFormattedChangeLogParser> clazz)
-
configureChangeSet(String, ChangeLogParameters, BufferedReader, StringBuilder, StringBuilder, ChangeSet, int, String, Matcher, ResourceAccessor)
instead