CompositeResourceAccessor fileOpener = new CompositeResourceAccessor(fsOpener, clOpener);
boolean includeCatalog = Boolean.parseBoolean(getCommandParam("includeCatalog", "false"));
boolean includeSchema = Boolean.parseBoolean(getCommandParam("includeSchema", "false"));
boolean includeTablespace = Boolean.parseBoolean(getCommandParam("includeTablespace", "false"));
DiffOutputControl diffOutputControl = new DiffOutputControl(includeCatalog, includeSchema, includeTablespace);
String referenceSchemaNames = getCommandParam("schemas", null);
CompareControl.SchemaComparison[] finalSchemaComparisons;
CatalogAndSchema[] finalSchemas;
if (referenceSchemaNames == null) {
finalSchemaComparisons = new CompareControl.SchemaComparison[] {new CompareControl.SchemaComparison(new CatalogAndSchema(defaultCatalogName, defaultSchemaName), new CatalogAndSchema(defaultCatalogName, defaultSchemaName))};
finalSchemas = new CatalogAndSchema[] {new CatalogAndSchema(defaultCatalogName, defaultSchemaName)};
} else {
List<CompareControl.SchemaComparison> schemaComparisons = new ArrayList<CompareControl.SchemaComparison>();
List<CatalogAndSchema> schemas = new ArrayList<CatalogAndSchema>();
for (String schema : referenceSchemaNames.split(",")) {
CatalogAndSchema correctedSchema = new CatalogAndSchema(null, schema).customize(database);
schemaComparisons.add(new CompareControl.SchemaComparison(correctedSchema, correctedSchema));
schemas.add(correctedSchema);
diffOutputControl.addIncludedSchema(correctedSchema);
}
finalSchemaComparisons = schemaComparisons.toArray(new CompareControl.SchemaComparison[schemaComparisons.size()]);
finalSchemas = schemas.toArray(new CatalogAndSchema[schemas.size()]);
}
for (CompareControl.SchemaComparison schema : finalSchemaComparisons) {
diffOutputControl.addIncludedSchema(schema.getReferenceSchema());
diffOutputControl.addIncludedSchema(schema.getComparisonSchema());
}
if ("diff".equalsIgnoreCase(command)) {
CommandLineUtils.doDiff(createReferenceDatabaseFromCommandParams(commandParams), database, StringUtils.trimToNull(diffTypes), finalSchemaComparisons);
return;