public class Resolver<G extends FileGroup>
File downloader with groups supporting files from multiple sources: local and remote (SFTP, SMB, HTTP).
| Modifier and Type | Class and Description |
|---|---|
static class |
Resolver.Companion |
| Modifier and Type | Field and Description |
|---|---|
static Resolver.Companion |
Companion |
static java.lang.String |
GROUP_DEFAULT |
| Constructor and Description |
|---|
Resolver(AemExtension aem,
java.io.File downloadDir)
File downloader with groups supporting files from multiple sources: local and remote (SFTP, SMB, HTTP).
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.io.File> |
allFiles(kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter) |
void |
config(kotlin.jvm.functions.Function1<? super G,kotlin.Unit> configurer)
Customize configuration for particular file group.
|
G |
createGroup(java.lang.String name) |
FileResolution |
download(java.lang.String url)
Download file using automatically determined file transfer (HTTP, SFTP, SMB, URL, local file system).
|
FileResolution |
downloadHttp(java.lang.String url,
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.http.HttpFileTransfer,kotlin.Unit> options)
Download file using HTTP file transfer with custom settings (like basic auth credentials).
|
FileResolution |
downloadSftp(java.lang.String url,
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.sftp.SftpFileTransfer,kotlin.Unit> options)
Download file using SFTP file transfer with custom settings (different credentials).
|
FileResolution |
downloadSmb(java.lang.String url,
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.smb.SmbFileTransfer,kotlin.Unit> options)
Download file using SMB file transfer with custom settings (different credentials, domain).
|
AemExtension |
getAem() |
java.util.List<java.io.File> |
getAllFiles() |
java.io.File |
getDownloadDir() |
java.util.List<G> |
getGroups() |
java.util.List<java.lang.String> |
getLocalFilePatterns()
Files respected when searching for recent local files.
|
java.util.List<java.io.File> |
getOutputDirs() |
G |
group(java.lang.String name) |
void |
group(java.lang.String name,
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.resolver.Resolver<G>,kotlin.Unit> configurer) |
void |
group(java.lang.String name,
java.lang.String downloadUrl)
Shorthand for creating named group with single file only to be downloaded.
|
java.util.List<java.io.File> |
outputDirs(kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter) |
FileResolution |
resolve(java.lang.String dependencyNotation)
Resolve file by dependency notation using defined Gradle repositories (Maven, Ivy etc).
|
FileResolution |
resolve(kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.build.DependencyOptions,kotlin.Unit> dependencyOptions)
Resolve file using defined Gradle repositories (Maven, Ivy etc).
|
java.util.List<G> |
resolveGroups(kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter) |
void |
setLocalFilePatterns(java.util.List<java.lang.String> p)
Files respected when searching for recent local files.
|
FileResolution |
useLocal(java.lang.String path)
Use local file directly (without copying).
|
FileResolution |
useLocal(java.io.File sourceFile)
Use local file directly (without copying).
|
FileResolution |
useLocalBy(java.lang.Object dir,
java.lang.Iterable<java.lang.String> filePatterns,
kotlin.jvm.functions.Function1<? super java.lang.Iterable<? extends java.io.File>,? extends java.io.File> selector)
Use local file from directory or file when not found any.
|
FileResolution |
useLocalBy(java.lang.Object dir,
kotlin.jvm.functions.Function1<? super java.lang.Iterable<? extends java.io.File>,? extends java.io.File> selector)
Use local file from directory or file when not found any.
|
FileResolution |
useLocalLastModified(java.lang.Object dir)
Use last modified local file located in directory or fail when not found any.
|
FileResolution |
useLocalLastNamed(java.lang.Object dir)
Use local file with name being highest version located in directory or fail when not found any.
Highest version is determined by descending alphanumeric sorting.
|
FileResolution |
useLocalRecent(java.lang.Object dir)
Use last modified local file located in directory or fail when not found any.
|
@NotNull public static java.lang.String GROUP_DEFAULT
public static Resolver.Companion Companion
public Resolver(@NotNull
AemExtension aem,
@NotNull
java.io.File downloadDir)
File downloader with groups supporting files from multiple sources: local and remote (SFTP, SMB, HTTP).
@Internal @NotNull public java.util.List<G> getGroups()
@Internal @NotNull public java.util.List<java.io.File> getOutputDirs()
@NotNull
public java.util.List<java.io.File> outputDirs(@NotNull
kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter)
@Internal @NotNull public java.util.List<java.io.File> getAllFiles()
@NotNull
public java.util.List<java.io.File> allFiles(@NotNull
kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter)
@NotNull
public java.util.List<G> resolveGroups(@NotNull
kotlin.jvm.functions.Function1<? super G,java.lang.Boolean> filter)
@NotNull
public G group(@NotNull
java.lang.String name)
@NotNull public FileResolution resolve(@NotNull java.lang.String dependencyNotation)
Resolve file by dependency notation using defined Gradle repositories (Maven, Ivy etc).
@NotNull public FileResolution resolve(@NotNull kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.build.DependencyOptions,kotlin.Unit> dependencyOptions)
Resolve file using defined Gradle repositories (Maven, Ivy etc).
@NotNull public FileResolution download(@NotNull java.lang.String url)
Download file using automatically determined file transfer (HTTP, SFTP, SMB, URL, local file system).
Same global settings (like basic auth credentials of HTTP) of each particular file transfer will be used for all files downloaded. This shorthand method assumes that mostly only single HTTP / SFTP / SMB server will be used to download all files.
To use many remote servers with different settings, simply use dedicated methods 'downloadHttp/Sftp/Smb' when declaring each file to be downloaded.
@NotNull public FileResolution downloadHttp(@NotNull java.lang.String url, @NotNull kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.http.HttpFileTransfer,kotlin.Unit> options)
Download file using HTTP file transfer with custom settings (like basic auth credentials).
Use only when using more than one remote HTTP server to download files.
@NotNull public FileResolution downloadSftp(@NotNull java.lang.String url, @NotNull kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.sftp.SftpFileTransfer,kotlin.Unit> options)
Download file using SFTP file transfer with custom settings (different credentials).
Use only when using more than one remote SFTP server to download files.
@NotNull public FileResolution downloadSmb(@NotNull java.lang.String url, @NotNull kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.smb.SmbFileTransfer,kotlin.Unit> options)
Download file using SMB file transfer with custom settings (different credentials, domain).
Use only when using more than one remote SMB server to download files.
@NotNull public FileResolution useLocal(@NotNull java.lang.String path)
Use local file directly (without copying).
@NotNull public FileResolution useLocal(@NotNull java.io.File sourceFile)
Use local file directly (without copying).
@Nullable public FileResolution useLocalBy(@NotNull java.lang.Object dir, @NotNull java.lang.Iterable<java.lang.String> filePatterns, @NotNull kotlin.jvm.functions.Function1<? super java.lang.Iterable<? extends java.io.File>,? extends java.io.File> selector)
Use local file from directory or file when not found any.
@Nullable public FileResolution useLocalBy(@NotNull java.lang.Object dir, @NotNull kotlin.jvm.functions.Function1<? super java.lang.Iterable<? extends java.io.File>,? extends java.io.File> selector)
Use local file from directory or file when not found any.
@Nullable public FileResolution useLocalLastNamed(@NotNull java.lang.Object dir)
Use local file with name being highest version located in directory or fail when not found any. Highest version is determined by descending alphanumeric sorting.
@Nullable public FileResolution useLocalLastModified(@NotNull java.lang.Object dir)
Use last modified local file located in directory or fail when not found any.
@Nullable public FileResolution useLocalRecent(@NotNull java.lang.Object dir)
Use last modified local file located in directory or fail when not found any.
@NotNull public java.util.List<java.lang.String> getLocalFilePatterns()
Files respected when searching for recent local files.
public void setLocalFilePatterns(@NotNull
java.util.List<java.lang.String> p)
Files respected when searching for recent local files.
public void config(@NotNull
kotlin.jvm.functions.Function1<? super G,kotlin.Unit> configurer)
Customize configuration for particular file group.
@Synchronized
public void group(@NotNull
java.lang.String name,
@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.resolver.Resolver<G>,kotlin.Unit> configurer)
public void group(@NotNull
java.lang.String name,
@NotNull
java.lang.String downloadUrl)
Shorthand for creating named group with single file only to be downloaded.
@NotNull
public G createGroup(@NotNull
java.lang.String name)
@Internal @NotNull public AemExtension getAem()
@Internal @NotNull public java.io.File getDownloadDir()