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 - jobjobStorage - job storage directorypublic JobStorage(Job job, File jobStorage, JobStorage otherJobContext, String id)
job - jobjobStorage - job storage directorypublic 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)
jobId - jobStorageDir - public void addContextFile(File file, String contextPath)
file - argument - public void removeContextFile(String contextPath)
file - argument - public String getContextFilePath(File file)
contextPath - the context path for the filepublic File getContextFile(String contextPath)
file - the File objectpublic File getContextDir()
public File makeContextZip()
public boolean existsInContext(String contextPath)
contextPath - public boolean isFileInContext(String contextPath)
contextPath - public boolean isDirectoryInContext(String contextPath)
contextPath - public void delete()
public String getStorageId()
Copyright © 2012–2016 The DAISY Consortium. All rights reserved.