@Validated
public interface JobFileService
Modifier and Type | Method and Description |
---|---|
void |
createJobDirectory(java.lang.String jobId)
Create the root of the job directory for the given job.
|
void |
deleteJobFile(java.lang.String jobId,
java.lang.String relativePath)
Given a job id this API will delete the entire file from the job directory this service implementation is
managing.
|
java.util.Set<JobFileState> |
getJobDirectoryFileState(java.lang.String jobId,
boolean calculateMd5)
Given a job id this API will traverse the job directory (if it exists) and return the set of all the files
including their relative paths from the directory root, the files' size and optionally a MD5 hash of the
file contents.
|
org.springframework.core.io.Resource |
getJobFileAsResource(java.lang.String jobId,
java.lang.String relativePath)
Given the expected path of a job resource (file or directory) for a given job return a
Resource
handle for this location. |
void |
updateFile(java.lang.String jobId,
java.lang.String relativePath,
long startByte,
byte[] data)
Given a job id and a relative path for a file for that job write the data provided into the file.
|
void createJobDirectory(java.lang.String jobId) throws java.io.IOException
jobId
- The id of the job to create the directory forjava.io.IOException
- When the job directory can't be createdjava.util.Set<JobFileState> getJobDirectoryFileState(java.lang.String jobId, boolean calculateMd5) throws java.io.IOException
jobId
- The id of the job to get the job directory state forcalculateMd5
- Whether to calculate the MD5 of the files or not. If true this will slow performance.JobFileState
metadata records for all files in the directoryjava.io.IOException
- On error reading the directoryvoid updateFile(java.lang.String jobId, java.lang.String relativePath, long startByte, byte[] data) throws java.io.IOException
jobId
- The id of the job this log file data belongs torelativePath
- The relative path (from the log directory root) this file exists atstartByte
- The starting byte of the datadata
- The actual data to be writtenjava.io.IOException
- On error writing the data to the given fileorg.springframework.core.io.Resource getJobFileAsResource(java.lang.String jobId, @Nullable java.lang.String relativePath)
Resource
handle for this location. A Resource
has an Resource.exists()
method that should be called to
ensure the underlying locations exists or not. No guarantee is made by implementations of this method that the
actual location exists.
Resource should not be written to outside the control of this service. In the future this access may be cut off.
jobId
- The id of the job to get the log file resource forrelativePath
- The relative path of the log file from the root of the given jobs' log directoryResource.exists()
void deleteJobFile(java.lang.String jobId, java.lang.String relativePath) throws java.io.IOException
jobId
- The id of the job to delete a file forrelativePath
- The relative path from the root of the job directory to deletejava.io.IOException
- On error deleting the file