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 Modifier and Type Method Description protected voidconfigureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher)protected ChangeSetconfigureChangeSet(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 AbstractSQLChangegetChange()protected abstract StringgetDocumentationLink()protected abstract StringgetEndMultiLineCommentSequence()intgetPriority()protected abstract StringgetSequenceName()protected abstract StringgetSingleLineCommentOneCharacter()protected abstract StringgetSingleLineCommentSequence()protected abstract StringgetStartMultiLineCommentSequence()protected abstract voidhandlePreconditionCase(ChangeLogParameters changeLogParameters, ChangeSet changeSet, Matcher preconditionMatcher)protected abstract voidhandlePreconditionsCase(ChangeSet changeSet, int count, Matcher preconditionsMatcher)protected abstract booleanisNotEndDelimiter(AbstractSQLChange change)protected InputStreamopenChangeLogFile(String physicalChangeLogLocation, ResourceAccessor resourceAccessor)DatabaseChangeLogparse(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor)Parses a Liquibase database changelog and returns the parsed form as an object.protected StringparseString(Matcher matcher)protected abstract voidsetChangeSequence(AbstractSQLChange change, String finalCurrentSequence)protected abstract voidsetChangeSequence(ChangeLogParameters changeLogParameters, StringBuilder currentSequence, ChangeSet changeSet, AbstractSQLChange change)protected voidsetLogicalFilePath(DatabaseChangeLog changeLog, String line, Matcher changeLogPatterMatcher)booleansupports(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 booleansupportsExtension(String changelogFile)
-
-
-
Field Detail
-
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
-
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
-
-
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:ChangeLogParserChecks if the file format is supported by an implementing ChangeLogParser and returns true if that is the case.- Specified by:
supportsin 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:
getPriorityin interfacePrioritizedService
-
parse
public DatabaseChangeLog parse(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor) throws ChangeLogParseException
Description copied from interface:ChangeLogParserParses a Liquibase database changelog and returns the parsed form as an object.- Specified by:
parsein 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
protected void configureChangeSet(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, BufferedReader reader, StringBuilder currentSequence, StringBuilder currentRollbackSequence, ChangeSet changeSet, int count, String line, Matcher commentMatcher) throws ChangeLogParseException, IOException
- Throws:
ChangeLogParseExceptionIOException
-
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
-
-