public class S3FileTransferImpl extends java.lang.Object implements FileTransfer
Constructor and Description |
---|
S3FileTransferImpl(@NotNull S3ClientFactory s3ClientFactory,
@NotNull io.micrometer.core.instrument.MeterRegistry registry,
@NotNull S3FileTransferProperties s3FileTransferProperties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
getFile(@NotBlank(message="Source file path cannot be empty.") java.lang.String srcRemotePath,
@NotBlank(message="Destination local path cannot be empty") java.lang.String dstLocalPath)
Gets a file from any remote location to Genie's local working directory.
|
long |
getLastModifiedTime(java.lang.String path)
Returns the last modified time of the file with the given path.
|
boolean |
isValid(java.lang.String fileName)
This method validates whether it can handle operations for a particular file
based on the prefix of the file like s3://, hdfs:// etc.
|
void |
putFile(@NotBlank(message="Source local path cannot be empty.") java.lang.String srcLocalPath,
@NotBlank(message="Destination remote path cannot be empty") java.lang.String dstRemotePath)
Puts a file from Genie's local working directory to a remote location.
|
public S3FileTransferImpl(@NotNull @NotNull S3ClientFactory s3ClientFactory, @NotNull @NotNull io.micrometer.core.instrument.MeterRegistry registry, @NotNull @NotNull S3FileTransferProperties s3FileTransferProperties)
s3ClientFactory
- The S3 client factory to useregistry
- The metrics registry to uses3FileTransferProperties
- Optionspublic boolean isValid(java.lang.String fileName) throws GenieException
isValid
in interface FileTransfer
fileName
- file name to validateGenieException
- if there are errorspublic void getFile(@NotBlank(message="Source file path cannot be empty.") @NotBlank(message="Source file path cannot be empty.") java.lang.String srcRemotePath, @NotBlank(message="Destination local path cannot be empty") @NotBlank(message="Destination local path cannot be empty") java.lang.String dstLocalPath) throws GenieException
getFile
in interface FileTransfer
srcRemotePath
- Source path of the files to copydstLocalPath
- Destination path of the files to copy toGenieException
- exception in case of an errorpublic void putFile(@NotBlank(message="Source local path cannot be empty.") @NotBlank(message="Source local path cannot be empty.") java.lang.String srcLocalPath, @NotBlank(message="Destination remote path cannot be empty") @NotBlank(message="Destination remote path cannot be empty") java.lang.String dstRemotePath) throws GenieException
putFile
in interface FileTransfer
srcLocalPath
- Source path of the files to copydstRemotePath
- Destination path of the files to copy toGenieException
- exception in case of an errorpublic long getLastModifiedTime(java.lang.String path) throws GenieException
getLastModifiedTime
in interface FileTransfer
path
- location of the fileGenieException
- exception in case of IO error