Package liquibase.parser
Class AbstractFormattedChangeLogParser
- java.lang.Object
-
- liquibase.parser.AbstractFormattedChangeLogParser
-
- All Implemented Interfaces:
ChangeLogParser
,LiquibaseParser
,PrioritizedService
- Direct Known Subclasses:
FormattedSqlChangeLogParser
public abstract class AbstractFormattedChangeLogParser extends Object implements ChangeLogParser
-
-
Field Summary
-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description AbstractFormattedChangeLogParser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher)
protected void
configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher, ResourceAccessor resourceAccessor)
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
getChange()
protected abstract String
getDocumentationLink()
protected abstract String
getEndMultiLineCommentSequence()
int
getPriority()
protected abstract String
getSequenceName()
protected abstract String
getSingleLineCommentOneCharacter()
protected abstract String
getSingleLineCommentSequence()
protected abstract String
getStartMultiLineCommentSequence()
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 abstract boolean
isNotEndDelimiter(AbstractSQLChange change)
protected InputStream
openChangeLogFile(String physicalChangeLogLocation, ResourceAccessor resourceAccessor)
DatabaseChangeLog
parse(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor)
Parses a Liquibase database changelog and returns the parsed form as an object.protected String
parseString(Matcher matcher)
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 Detail
-
EXCEPTION_MESSAGE
protected static final String EXCEPTION_MESSAGE
-
FIRST_LINE_REGEX
protected final String FIRST_LINE_REGEX
-
FIRST_LINE_PATTERN
protected final Pattern FIRST_LINE_PATTERN
-
PROPERTY_REGEX
protected final String PROPERTY_REGEX
-
PROPERTY_PATTERN
protected final Pattern PROPERTY_PATTERN
-
ALT_PROPERTY_ONE_CHARACTER_REGEX
protected final String ALT_PROPERTY_ONE_CHARACTER_REGEX
-
ALT_PROPERTY_ONE_CHARACTER_PATTERN
protected final Pattern ALT_PROPERTY_ONE_CHARACTER_PATTERN
-
CHANGE_SET_REGEX
protected final String CHANGE_SET_REGEX
-
CHANGE_SET_PATTERN
protected final Pattern CHANGE_SET_PATTERN
-
ALT_CHANGE_SET_ONE_CHARACTER_REGEX
protected final String ALT_CHANGE_SET_ONE_CHARACTER_REGEX
-
ALT_CHANGE_SET_ONE_CHARACTER_PATTERN
protected final Pattern ALT_CHANGE_SET_ONE_CHARACTER_PATTERN
-
ALT_CHANGE_SET_NO_OTHER_INFO_REGEX
protected final String ALT_CHANGE_SET_NO_OTHER_INFO_REGEX
-
ALT_CHANGE_SET_NO_OTHER_INFO_PATTERN
protected final Pattern ALT_CHANGE_SET_NO_OTHER_INFO_PATTERN
-
ROLLBACK_REGEX
protected final String ROLLBACK_REGEX
-
ROLLBACK_PATTERN
protected final Pattern ROLLBACK_PATTERN
-
ALT_ROLLBACK_ONE_CHARACTER_REGEX
protected final String ALT_ROLLBACK_ONE_CHARACTER_REGEX
-
ALT_ROLLBACK_ONE_CHARACTER_PATTERN
protected final Pattern ALT_ROLLBACK_ONE_CHARACTER_PATTERN
-
PRECONDITIONS_REGEX
protected final String PRECONDITIONS_REGEX
-
PRECONDITIONS_PATTERN
protected final Pattern PRECONDITIONS_PATTERN
-
ALT_PRECONDITIONS_ONE_CHARACTER_REGEX
protected final String ALT_PRECONDITIONS_ONE_CHARACTER_REGEX
-
ALT_PRECONDITIONS_ONE_CHARACTER_PATTERN
protected final Pattern ALT_PRECONDITIONS_ONE_CHARACTER_PATTERN
-
PRECONDITION_REGEX
protected final String PRECONDITION_REGEX
-
PRECONDITION_PATTERN
protected final Pattern PRECONDITION_PATTERN
-
INVALID_EMPTY_PRECONDITION_REGEX
protected final String INVALID_EMPTY_PRECONDITION_REGEX
-
INVALID_EMPTY_PRECONDITION_PATTERN
protected final Pattern INVALID_EMPTY_PRECONDITION_PATTERN
-
ALT_PRECONDITION_ONE_CHARACTER_REGEX
protected final String ALT_PRECONDITION_ONE_CHARACTER_REGEX
-
ALT_PRECONDITION_ONE_CHARACTER_PATTERN
protected final Pattern ALT_PRECONDITION_ONE_CHARACTER_PATTERN
-
STRIP_COMMENTS_REGEX
protected static final String STRIP_COMMENTS_REGEX
- See Also:
- Constant Field Values
-
STRIP_COMMENTS_PATTERN
protected final Pattern STRIP_COMMENTS_PATTERN
-
SPLIT_STATEMENTS_REGEX
protected static final String SPLIT_STATEMENTS_REGEX
- See Also:
- Constant Field Values
-
SPLIT_STATEMENTS_PATTERN
protected final Pattern SPLIT_STATEMENTS_PATTERN
-
ROLLBACK_SPLIT_STATEMENTS_REGEX
protected static final String ROLLBACK_SPLIT_STATEMENTS_REGEX
- See Also:
- Constant Field Values
-
ROLLBACK_SPLIT_STATEMENTS_PATTERN
protected final Pattern ROLLBACK_SPLIT_STATEMENTS_PATTERN
-
END_DELIMITER_REGEX
protected static final String END_DELIMITER_REGEX
- See Also:
- Constant Field Values
-
END_DELIMITER_PATTERN
protected final Pattern END_DELIMITER_PATTERN
-
ROLLBACK_END_DELIMITER_REGEX
protected static final String ROLLBACK_END_DELIMITER_REGEX
- See Also:
- Constant Field Values
-
ROLLBACK_END_DELIMITER_PATTERN
protected final Pattern ROLLBACK_END_DELIMITER_PATTERN
-
COMMENT_REGEX
protected final String COMMENT_REGEX
-
COMMENT_PATTERN
protected final Pattern COMMENT_PATTERN
-
ALT_COMMENT_PLURAL_REGEX
protected final String ALT_COMMENT_PLURAL_REGEX
-
ALT_COMMENT_PLURAL_PATTERN
protected final Pattern ALT_COMMENT_PLURAL_PATTERN
-
ALT_COMMENT_ONE_CHARACTER_REGEX
protected final String ALT_COMMENT_ONE_CHARACTER_REGEX
-
ALT_COMMENT_ONE_CHARACTER_PATTERN
protected final Pattern ALT_COMMENT_ONE_CHARACTER_PATTERN
-
VALID_CHECK_SUM_REGEX
protected final String VALID_CHECK_SUM_REGEX
-
VALID_CHECK_SUM_PATTERN
protected final Pattern VALID_CHECK_SUM_PATTERN
-
ALT_VALID_CHECK_SUM_ONE_CHARACTER_REGEX
protected final String ALT_VALID_CHECK_SUM_ONE_CHARACTER_REGEX
-
ALT_VALID_CHECK_SUM_ONE_CHARACTER_PATTERN
protected final Pattern ALT_VALID_CHECK_SUM_ONE_CHARACTER_PATTERN
-
IGNORE_LINES_REGEX
protected final String IGNORE_LINES_REGEX
-
IGNORE_LINES_PATTERN
protected final Pattern IGNORE_LINES_PATTERN
-
ALT_IGNORE_LINES_ONE_CHARACTER_REGEX
protected final String ALT_IGNORE_LINES_ONE_CHARACTER_REGEX
-
ALT_IGNORE_LINES_ONE_CHARACTER_PATTERN
protected final Pattern ALT_IGNORE_LINES_ONE_CHARACTER_PATTERN
-
ALT_IGNORE_REGEX
protected final String ALT_IGNORE_REGEX
-
ALT_IGNORE_PATTERN
protected final Pattern ALT_IGNORE_PATTERN
-
RUN_WITH_REGEX
protected static final String RUN_WITH_REGEX
- See Also:
- Constant Field Values
-
RUN_WITH_PATTERN
protected final Pattern RUN_WITH_PATTERN
-
RUN_WITH_SPOOL_FILE_REGEX
protected static final String RUN_WITH_SPOOL_FILE_REGEX
- See Also:
- Constant Field Values
-
RUN_WITH_SPOOL_FILE_PATTERN
protected final Pattern RUN_WITH_SPOOL_FILE_PATTERN
-
RUN_ON_CHANGE_REGEX
protected static final String RUN_ON_CHANGE_REGEX
- See Also:
- Constant Field Values
-
RUN_ON_CHANGE_PATTERN
protected final Pattern RUN_ON_CHANGE_PATTERN
-
RUN_ALWAYS_REGEX
protected static final String RUN_ALWAYS_REGEX
- See Also:
- Constant Field Values
-
RUN_ALWAYS_PATTERN
protected final Pattern RUN_ALWAYS_PATTERN
-
CONTEXT_REGEX
protected static final String CONTEXT_REGEX
- See Also:
- Constant Field Values
-
CONTEXT_PATTERN
protected final Pattern CONTEXT_PATTERN
-
CONTEXT_FILTER_REGEX
protected static final String CONTEXT_FILTER_REGEX
- See Also:
- Constant Field Values
-
CONTEXT_FILTER_PATTERN
protected final Pattern CONTEXT_FILTER_PATTERN
-
LOGICAL_FILE_PATH_REGEX
protected static final String LOGICAL_FILE_PATH_REGEX
- See Also:
- Constant Field Values
-
LOGICAL_FILE_PATH_PATTERN
protected final Pattern LOGICAL_FILE_PATH_PATTERN
-
LABELS_REGEX
protected static final String LABELS_REGEX
- See Also:
- Constant Field Values
-
LABELS_PATTERN
protected final Pattern LABELS_PATTERN
-
RUN_IN_TRANSACTION_REGEX
protected static final String RUN_IN_TRANSACTION_REGEX
- See Also:
- Constant Field Values
-
RUN_IN_TRANSACTION_PATTERN
protected final Pattern RUN_IN_TRANSACTION_PATTERN
-
DBMS_REGEX
protected static final String DBMS_REGEX
- See Also:
- Constant Field Values
-
DBMS_PATTERN
protected final Pattern DBMS_PATTERN
-
IGNORE_REGEX
protected static final String IGNORE_REGEX
- See Also:
- Constant Field Values
-
IGNORE_PATTERN
protected final Pattern IGNORE_PATTERN
-
FAIL_ON_ERROR_REGEX
protected static final String FAIL_ON_ERROR_REGEX
- See Also:
- Constant Field Values
-
FAIL_ON_ERROR_PATTERN
protected final Pattern FAIL_ON_ERROR_PATTERN
-
ON_FAIL_REGEX
protected static final String ON_FAIL_REGEX
- See Also:
- Constant Field Values
-
ON_FAIL_PATTERN
protected final Pattern ON_FAIL_PATTERN
-
ON_ERROR_REGEX
protected static final String ON_ERROR_REGEX
- See Also:
- Constant Field Values
-
ON_ERROR_PATTERN
protected final Pattern ON_ERROR_PATTERN
-
ROLLBACK_CHANGE_SET_ID_REGEX
protected static final String ROLLBACK_CHANGE_SET_ID_REGEX
- See Also:
- Constant Field Values
-
ROLLBACK_CHANGE_SET_ID_PATTERN
protected final Pattern ROLLBACK_CHANGE_SET_ID_PATTERN
-
ROLLBACK_CHANGE_SET_AUTHOR_REGEX
protected static final String ROLLBACK_CHANGE_SET_AUTHOR_REGEX
- See Also:
- Constant Field Values
-
ROLLBACK_CHANGE_SET_AUTHOR_PATTERN
protected final Pattern ROLLBACK_CHANGE_SET_AUTHOR_PATTERN
-
ROLLBACK_CHANGE_SET_PATH_REGEX
protected static final String ROLLBACK_CHANGE_SET_PATH_REGEX
- See Also:
- Constant Field Values
-
ROLLBACK_CHANGE_SET_PATH_PATTERN
protected final Pattern ROLLBACK_CHANGE_SET_PATH_PATTERN
-
ROLLBACK_MULTI_LINE_START_REGEX
protected final String ROLLBACK_MULTI_LINE_START_REGEX
-
ROLLBACK_MULTI_LINE_START_PATTERN
protected final Pattern ROLLBACK_MULTI_LINE_START_PATTERN
-
ROLLBACK_MULTI_LINE_END_REGEX
protected final String ROLLBACK_MULTI_LINE_END_REGEX
-
ROLLBACK_MULTI_LINE_END_PATTERN
protected final Pattern ROLLBACK_MULTI_LINE_END_PATTERN
-
WORD_RESULT_REGEX
protected static final String WORD_RESULT_REGEX
- See Also:
- Constant Field Values
-
SINGLE_QUOTE_RESULT_REGEX
protected static final String SINGLE_QUOTE_RESULT_REGEX
- See Also:
- Constant Field Values
-
DOUBLE_QUOTE_RESULT_REGEX
protected static final String DOUBLE_QUOTE_RESULT_REGEX
- See Also:
- Constant Field Values
-
WORD_AND_QUOTING_PATTERNS
protected final Pattern[] WORD_AND_QUOTING_PATTERNS
-
NAME_REGEX
protected static final String NAME_REGEX
- See Also:
- Constant Field Values
-
NAME_PATTERN
protected final Pattern NAME_PATTERN
-
VALUE_REGEX
protected static final String VALUE_REGEX
- See Also:
- Constant Field Values
-
VALUE_PATTERN
protected final Pattern VALUE_PATTERN
-
GLOBAL_REGEX
protected static final String GLOBAL_REGEX
- See Also:
- Constant Field Values
-
GLOBAL_PATTERN
protected final Pattern GLOBAL_PATTERN
-
VIEW_NAME_STATEMENT_REGEX
protected static final String VIEW_NAME_STATEMENT_REGEX
- See Also:
- Constant Field Values
-
VIEW_NAME_STATEMENT_PATTERN
protected final Pattern VIEW_NAME_STATEMENT_PATTERN
-
TABLE_NAME_STATEMENT_REGEX
protected static final String TABLE_NAME_STATEMENT_REGEX
- See Also:
- Constant Field Values
-
TABLE_NAME_STATEMENT_PATTERN
protected final Pattern TABLE_NAME_STATEMENT_PATTERN
-
SCHEMA_NAME_STATEMENT_REGEX
protected static final String SCHEMA_NAME_STATEMENT_REGEX
- See Also:
- Constant Field Values
-
SCHEMA_NAME_STATEMENT_PATTERN
protected final Pattern SCHEMA_NAME_STATEMENT_PATTERN
-
-
Method Detail
-
getSingleLineCommentOneCharacter
protected abstract String getSingleLineCommentOneCharacter()
-
getSingleLineCommentSequence
protected abstract String getSingleLineCommentSequence()
-
getStartMultiLineCommentSequence
protected abstract String getStartMultiLineCommentSequence()
-
getEndMultiLineCommentSequence
protected abstract String getEndMultiLineCommentSequence()
-
supportsExtension
protected abstract boolean supportsExtension(String changelogFile)
-
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
protected abstract AbstractSQLChange getChange()
-
getDocumentationLink
protected abstract String getDocumentationLink()
-
getSequenceName
protected abstract String getSequenceName()
-
setChangeSequence
protected abstract void setChangeSequence(AbstractSQLChange change, String finalCurrentSequence)
-
isNotEndDelimiter
protected abstract boolean isNotEndDelimiter(AbstractSQLChange change)
-
setChangeSequence
protected abstract void setChangeSequence(ChangeLogParameters changeLogParameters, StringBuilder currentSequence, ChangeSet changeSet, AbstractSQLChange change)
-
supports
public boolean supports(String changeLogFile, ResourceAccessor resourceAccessor)
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
-
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 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)
-
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
-
-