Implement the ChangeLogIterator class that processes a list of change sets in a database change log. The functionality includes iterating over these change sets and applying visitor patterns to potentially modify or act upon each change set based on specified filters and visitation direction (normal or reverse).
Input/Output Requirements
Input:
The constructor of ChangeLogIterator should accept:
A DatabaseChangeLog object that holds the change sets.
An optional array of ChangeSetFilter objects that determine whether individual change sets are accepted for visitation.
The run method should accept:
A ChangeSetVisitor object that will define how to process each chosen change set.
A Database object that provides the context for the operation.
Output:
The method should not return any value (void). Instead, results of the visitation will be handled within the ChangeSetVisitor.
Implementation Steps
Create a ChangeLogIterator class in the /app/ directory.
Implement the constructor to initialize the change log and filters.
Implement the run method to:
Retrieve and possibly reverse the list of change sets based on the visitor's direction.
Iterate over the change sets:
Apply filters to determine if the change set should be visited.
Call the visit method of the provided ChangeSetVisitor for each acceptable change set.
Ensure exception handling by throwing LiquibaseException as needed.
Deliverable
A fully functional ChangeLogIterator class located in the /app/ directory that adheres to the functionality specifications outlined above.