use of org.springframework.boot.actuate.endpoint.LiquibaseEndpoint.LiquibaseReport in project spring-boot by spring-projects.
the class LiquibaseEndpoint method invoke.
@Override
public List<LiquibaseReport> invoke() {
List<LiquibaseReport> reports = new ArrayList<>();
DatabaseFactory factory = DatabaseFactory.getInstance();
StandardChangeLogHistoryService service = new StandardChangeLogHistoryService();
for (Map.Entry<String, SpringLiquibase> entry : this.liquibases.entrySet()) {
try {
DataSource dataSource = entry.getValue().getDataSource();
JdbcConnection connection = new JdbcConnection(dataSource.getConnection());
try {
Database database = factory.findCorrectDatabaseImplementation(connection);
reports.add(new LiquibaseReport(entry.getKey(), service.queryDatabaseChangeLogTable(database)));
} finally {
connection.close();
}
} catch (Exception ex) {
throw new IllegalStateException("Unable to get Liquibase changelog", ex);
}
}
return reports;
}
Aggregations