public class FileTransferManager implements FileTransfer
Facade for transferring files over multiple protocols HTTP/SFTP/SMB and custom.
Handles locking files for avoiding uncompleted downloads. Prevents unnecessary download if file on local server already exist. Prevents unnecessary uploads if file on remote servers already exist.
@NotNull public static java.lang.String NAME
@NotNull public static java.lang.String TMP_SUFFIX
public static com.cognifide.gradle.aem.common.file.transfer.FileTransferManager.Companion Companion
public FileTransferManager(@NotNull
AemExtension aem)
Facade for transferring files over multiple protocols HTTP/SFTP/SMB and custom.
Handles locking files for avoiding uncompleted downloads. Prevents unnecessary download if file on local server already exist. Prevents unnecessary uploads if file on remote servers already exist.
@NotNull public FileTransferFactory getFactory()
@NotNull public HttpFileTransfer getHttp()
public void http(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.http.HttpFileTransfer,kotlin.Unit> options)
@NotNull public SftpFileTransfer getSftp()
public void sftp(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.sftp.SftpFileTransfer,kotlin.Unit> options)
@NotNull public SmbFileTransfer getSmb()
public void smb(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.smb.SmbFileTransfer,kotlin.Unit> options)
@NotNull public ResolveFileTransfer getResolve()
public void resolve(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.resolve.ResolveFileTransfer,kotlin.Unit> options)
@NotNull public UrlFileTransfer getUrl()
public void url(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.generic.UrlFileTransfer,kotlin.Unit> options)
@NotNull public PathFileTransfer getPath()
public void path(@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.generic.PathFileTransfer,kotlin.Unit> options)
public void download(@NotNull
java.lang.String fileUrl)
Downloads file from specified URL to temporary directory with preserving file name.
public void downloadFrom(@NotNull
java.lang.String dirUrl,
@NotNull
java.lang.String fileName,
@NotNull
java.io.File target)
Downloads file of given name from directory at specified URL.
public void uploadTo(@NotNull
java.lang.String dirUrl,
@NotNull
java.lang.String fileName,
@NotNull
java.io.File source)
Uploads file to directory at specified URL and set given name.
@NotNull
public java.util.List<com.cognifide.gradle.aem.common.file.transfer.FileEntry> list(@NotNull
java.lang.String dirUrl)
Lists files in directory available at specified URL.
public void deleteFrom(@NotNull
java.lang.String dirUrl,
@NotNull
java.lang.String fileName)
Deletes file of given name in directory at specified URL.
public void truncate(@NotNull
java.lang.String dirUrl)
Deletes all files in directory available at specified URL.
@Nullable public FileEntry stat(@NotNull java.lang.String dirUrl, @NotNull java.lang.String fileName)
Gets file status of given name in directory at specified URL.
public boolean handles(@NotNull
java.lang.String fileUrl)
Check if there is any file transfer supporting specified URL.
@NotNull public FileTransfer handling(@NotNull java.lang.String fileUrl)
Get file transfer supporting specified URL.
public void custom(@NotNull
java.lang.String name,
@NotNull
kotlin.jvm.functions.Function1<? super com.cognifide.gradle.aem.common.file.transfer.generic.CustomFileTransfer,kotlin.Unit> definition)
Register custom file transfer for e.g downloading / uploading files from cloud storages like: Amazon S3, Google Cloud Storage etc.
@NotNull public FileTransfer named(@NotNull java.lang.String name)
Get custom (or built-in) file transfer by name.
public void credentials(@Nullable
java.lang.String user,
@Nullable
java.lang.String password,
@Nullable
java.lang.String domain)
Shorthand method to set same credentials for all protocols requiring it.
Useful only in specific cases, when e.g company storage offers accessing files via multiple protocols using same AD credentials.
public boolean getEnabled()
When enabled, transfer will be considered when finding transfer handling particular URL.
public boolean getParallelable()
Determines if operations using this transfer could be done in parallel.
@NotNull public java.lang.String getName()
Unique identifier.