@Validated public interface JobFileService
|Modifier and Type||Method and Description|
Create the root of the job directory for the given job.
Given a job id this API will delete the entire file from the job directory this service implementation is managing.
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.
Given the expected path of a job resource (file or directory) for a given job return a
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 for
java.io.IOException- When the job directory can't be created
java.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 for
calculateMd5- Whether to calculate the MD5 of the files or not. If true this will slow performance.
JobFileStatemetadata records for all files in the directory
java.io.IOException- On error reading the directory
void 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 to
relativePath- The relative path (from the log directory root) this file exists at
startByte- The starting byte of the data
data- The actual data to be written
java.io.IOException- On error writing the data to the given file
org.springframework.core.io.Resource getJobFileAsResource(java.lang.String jobId, @Nullable java.lang.String relativePath)
Resourcehandle for this location. A
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 for
relativePath- The relative path of the log file from the root of the given jobs' log directory
void deleteJobFile(java.lang.String jobId, java.lang.String relativePath) throws java.io.IOException
jobId- The id of the job to delete a file for
relativePath- The relative path from the root of the job directory to delete
java.io.IOException- On error deleting the file