use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator in project flyway by flyway.
the class JdbcMigrationResolver method resolveMigrations.
@Override
public List<ResolvedMigration> resolveMigrations() {
List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();
if (!location.isClassPath()) {
return migrations;
}
try {
Class<?>[] classes = scanner.scanForClasses(location, JdbcMigration.class);
for (Class<?> clazz : classes) {
JdbcMigration jdbcMigration = ClassUtils.instantiate(clazz.getName(), scanner.getClassLoader());
ConfigurationInjectionUtils.injectFlywayConfiguration(jdbcMigration, configuration);
ResolvedMigrationImpl migrationInfo = extractMigrationInfo(jdbcMigration);
migrationInfo.setPhysicalLocation(ClassUtils.getLocationOnDisk(clazz));
migrationInfo.setExecutor(new JdbcMigrationExecutor(jdbcMigration));
migrations.add(migrationInfo);
}
} catch (Exception e) {
throw new FlywayException("Unable to resolve Jdbc Java migrations in location: " + location + " (" + e.getMessage() + ")", e);
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator in project flyway by flyway.
the class SpringJdbcMigrationResolver method resolveMigrations.
@Override
public Collection<ResolvedMigration> resolveMigrations() {
List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();
if (!location.isClassPath()) {
return migrations;
}
try {
Class<?>[] classes = scanner.scanForClasses(location, SpringJdbcMigration.class);
for (Class<?> clazz : classes) {
SpringJdbcMigration springJdbcMigration = ClassUtils.instantiate(clazz.getName(), scanner.getClassLoader());
ConfigurationInjectionUtils.injectFlywayConfiguration(springJdbcMigration, configuration);
ResolvedMigrationImpl migrationInfo = extractMigrationInfo(springJdbcMigration);
migrationInfo.setPhysicalLocation(ClassUtils.getLocationOnDisk(clazz));
migrationInfo.setExecutor(new SpringJdbcMigrationExecutor(springJdbcMigration));
migrations.add(migrationInfo);
}
} catch (Exception e) {
throw new FlywayException("Unable to resolve Spring Jdbc Java migrations in location: " + location, e);
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator in project registry by hortonworks.
the class ShellMigrationResolver method resolveMigrations.
public List<ResolvedMigration> resolveMigrations() {
List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();
Resource[] resources = scanner.scanForResources(location, shellMigrationPrefix, shellMigrationSuffix);
for (Resource resource : resources) {
ResolvedMigrationImpl resolvedMigration = extractMigrationInfo(resource);
resolvedMigration.setPhysicalLocation(resource.getLocationOnDisk());
resolvedMigration.setExecutor(new ShellMigrationExecutor(resource));
migrations.add(resolvedMigration);
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator in project flyway by flyway.
the class ScanningJavaMigrationResolver method resolveMigrations.
@Override
public List<ResolvedMigration> resolveMigrations(Context context) {
List<ResolvedMigration> migrations = new ArrayList<>();
for (Class<?> clazz : classProvider.getClasses()) {
JavaMigration javaMigration = ClassUtils.instantiate(clazz.getName(), configuration.getClassLoader());
migrations.add(new ResolvedJavaMigration(javaMigration));
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator in project flyway by flyway.
the class FixedJavaMigrationResolver method resolveMigrations.
@Override
public List<ResolvedMigration> resolveMigrations(Context context) {
List<ResolvedMigration> migrations = new ArrayList<>();
for (JavaMigration javaMigration : javaMigrations) {
migrations.add(new ResolvedJavaMigration(javaMigration));
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
Aggregations