public class JobStorage extends Object
Constructor and Description |
---|
JobStorage(Job job,
File jobStorage,
JobStorage otherJobContext,
String id)
Create a JobStorage associated with the provided Job, and copy the context from another job.
|
JobStorage(Job job,
File jobStorage,
String id)
Create a JobStorage associated with the provided Job.
|
Modifier and Type | Method and Description |
---|---|
void |
addContextFile(File file,
String contextPath)
Add the file to the context.
|
void |
delete()
Deletes the job including all its files from the job storage.
|
boolean |
existsInContext(String contextPath)
Test whether the given path exists in the context.
|
File |
getContextDir()
Returns the root directory for the context files.
|
File |
getContextFile(String contextPath)
Get the path in context associated with the File.
|
String |
getContextFilePath(File file)
Get the file associated with the given context path.
|
String |
getStorageId() |
boolean |
isDirectoryInContext(String contextPath)
Test whether the given path exists as a directory in the context.
|
boolean |
isFileInContext(String contextPath)
Test whether the given path exists as a file in the context.
|
void |
lazyLoad()
Load the job.
|
static List<String> |
listJobs(File jobStorage)
List all job IDs that are stored in the given job storage folder.
|
static Job |
loadJob(String storageId,
File jobStorageDir)
Load a job from the job storage folder.
|
File |
makeContextZip()
Bundles all context files up as a ZIP archive and returns it.
|
void |
removeContextFile(String contextPath)
Remove the file from the context.
|
void |
save()
Save the job to the job storage.
|
void |
save(boolean moveFiles)
Save the job to the job storage.
|
public JobStorage(Job job, File jobStorage, String id)
job
- The jobjobStorage
- The job storage directoryid
- The job Idpublic JobStorage(Job job, File jobStorage, JobStorage otherJobContext, String id)
job
- The jobjobStorage
- The job storage directoryotherJobContext
- Copy context from this job storageid
- The job Idpublic void lazyLoad()
public void save()
public void save(boolean moveFiles)
moveFiles
- if set to false, will make copies of the context files instead of moving them.public static List<String> listJobs(File jobStorage)
jobStorage
- the directory where jobs are storedpublic static Job loadJob(String storageId, File jobStorageDir)
storageId
- The jobs Id in the storagejobStorageDir
- The job storage directorypublic void addContextFile(File file, String contextPath)
file
- The filecontextPath
- the path to the file in the contextpublic void removeContextFile(String contextPath)
contextPath
- the path to the file in the contextpublic String getContextFilePath(File file)
file
- the filepublic File getContextFile(String contextPath)
contextPath
- the path to the file in the contextpublic File getContextDir()
public File makeContextZip()
public boolean existsInContext(String contextPath)
contextPath
- the path to the file in the contextpublic boolean isFileInContext(String contextPath)
contextPath
- the path to the file in the contextpublic boolean isDirectoryInContext(String contextPath)
contextPath
- the path to the file in the contextpublic void delete()
public String getStorageId()
Copyright © 2012–2022 The DAISY Consortium. All rights reserved.