Search in sources :

Example 6 with LoadableResource

use of org.flywaydb.core.api.resource.LoadableResource in project flyway by flyway.

the class SqlMigrationResolver method createPlaceholderReplacingLoadableResources.

private LoadableResource[] createPlaceholderReplacingLoadableResources(List<LoadableResource> loadableResources) {
    List<LoadableResource> list = new ArrayList<>();
    for (final LoadableResource loadableResource : loadableResources) {
        LoadableResource placeholderReplacingLoadableResource = new LoadableResource() {

            @Override
            public Reader read() {
                return PlaceholderReplacingReader.create(configuration, parsingContext, loadableResource.read());
            }

            @Override
            public String getAbsolutePath() {
                return loadableResource.getAbsolutePath();
            }

            @Override
            public String getAbsolutePathOnDisk() {
                return loadableResource.getAbsolutePathOnDisk();
            }

            @Override
            public String getFilename() {
                return loadableResource.getFilename();
            }

            @Override
            public String getRelativePath() {
                return loadableResource.getRelativePath();
            }
        };
        list.add(placeholderReplacingLoadableResource);
    }
    return list.toArray(new LoadableResource[0]);
}
Also used : LoadableResource(org.flywaydb.core.api.resource.LoadableResource) ArrayList(java.util.ArrayList)

Aggregations

LoadableResource (org.flywaydb.core.api.resource.LoadableResource)6 ArrayList (java.util.ArrayList)3 File (java.io.File)1 Charset (java.nio.charset.Charset)1 TreeSet (java.util.TreeSet)1 FlywayException (org.flywaydb.core.api.FlywayException)1 Location (org.flywaydb.core.api.Location)1 Callback (org.flywaydb.core.api.callback.Callback)1 ResolvedMigrationImpl (org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)1 ResourceName (org.flywaydb.core.internal.resource.ResourceName)1 ResourceNameParser (org.flywaydb.core.internal.resource.ResourceNameParser)1 FileSystemResource (org.flywaydb.core.internal.resource.filesystem.FileSystemResource)1 AwsS3Resource (org.flywaydb.core.internal.resource.s3.AwsS3Resource)1 ClassPathScanner (org.flywaydb.core.internal.scanner.classpath.ClassPathScanner)1 SqlScript (org.flywaydb.core.internal.sqlscript.SqlScript)1 SqlScriptMetadata (org.flywaydb.core.internal.sqlscript.SqlScriptMetadata)1 S3Object (software.amazon.awssdk.services.s3.model.S3Object)1