public class HttpFileTransferImpl extends java.lang.Object implements FileTransfer
Constructor and Description |
---|
HttpFileTransferImpl(@NotNull org.springframework.web.client.RestTemplate restTemplate,
@NotNull io.micrometer.core.instrument.MeterRegistry registry)
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 HttpFileTransferImpl(@NotNull @NotNull org.springframework.web.client.RestTemplate restTemplate, @NotNull @NotNull io.micrometer.core.instrument.MeterRegistry registry)
restTemplate
- The rest template to useregistry
- The metrics registry to usepublic 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