use of liquibase.snapshot.SnapshotListener in project liquibase by liquibase.
the class InternalSnapshotCommandStep method run.
@Override
public void run(CommandResultsBuilder resultsBuilder) throws Exception {
CommandScope commandScope = resultsBuilder.getCommandScope();
Database database = commandScope.getArgumentValue(DATABASE_ARG);
SnapshotListener snapshotListener = commandScope.getArgumentValue(SNAPSHOT_LISTENER_ARG);
CatalogAndSchema[] schemas = commandScope.getArgumentValue(SCHEMAS_ARG);
InternalSnapshotCommandStep.logUnsupportedDatabase(database, this.getClass());
SnapshotControl snapshotControl = new SnapshotControl(database);
snapshotControl.setSnapshotListener(snapshotListener);
if (schemas == null) {
schemas = new CatalogAndSchema[] { database.getDefaultSchema() };
}
ObjectQuotingStrategy originalQuotingStrategy = database.getObjectQuotingStrategy();
database.setObjectQuotingStrategy(ObjectQuotingStrategy.QUOTE_ALL_OBJECTS);
DatabaseSnapshot snapshot;
try {
snapshot = SnapshotGeneratorFactory.getInstance().createSnapshot(schemas, database, snapshotControl);
} finally {
database.setObjectQuotingStrategy(originalQuotingStrategy);
}
snapshot.setMetadata(this.getSnapshotMetadata());
resultsBuilder.addResult("snapshot", snapshot);
}
Aggregations