Class DownloadJob
java.lang.Object
io.goobi.viewer.model.job.download.DownloadJob
- Direct Known Subclasses:
EpubDownloadJob,PdfDownloadJob
Abstract base class for asynchronous download jobs that generate files (e.g. PDF or EPUB) for digitized records.
Manages job state, file locking, expiry, and user notification via e-mail.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()abstract voidbooleanstatic DownloadJobfrom(ViewerMessage message) abstract Stringabstract Stringabstract PathgetPath()getPi()protected PathCreates path to a temporary file to which the data is written.getTimeToLive.abstract StringgetType()booleanisExpired.booleanisLocked()booleannotifyObserver(String email, JobStatus status, URI downloadUri) notifyObservers.boolean
-
Field Details
-
FILE_EXTENSION_CREATING_LOCK
- See Also:
-
-
Constructor Details
-
DownloadJob
-
DownloadJob
-
-
Method Details
-
getFilename
-
getPath
-
getType
-
getPi
-
getTempPath
Creates path to a temporary file to which the data is written. Only after completion is the file moved to #getPath()- Returns:
- a path
-
create
public void create() throws PresentationException, IOException, IndexUnreachableException, RecordNotFoundException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- Throws:
PresentationExceptionIOExceptionIndexUnreachableExceptionRecordNotFoundExceptionde.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
-
create
public abstract void create(Dataset work) throws IOException, PresentationException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException - Throws:
IOExceptionPresentationExceptionde.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
-
createLock
- Throws:
IOException
-
releaseLock
- Throws:
IOException
-
isLocked
- Throws:
IOException
-
notifyObserver
public boolean notifyObserver(String email, JobStatus status, URI downloadUri) throws UnsupportedEncodingException, MessagingException notifyObservers.- Parameters:
email- recipient email address to notifystatus- aJobStatusobject.downloadUri- the URI under which the download is made available- Returns:
- true if the notification email was sent successfully, false otherwise
- Throws:
UnsupportedEncodingException- if any.MessagingException- if any.
-
getExirationTime
- Throws:
IOException
-
getTimeToLive
getTimeToLive.- Returns:
- the configured download PDF time-to-live formatted as "Dd H:MM:SS"
-
isExpired
public boolean isExpired()isExpired.- Returns:
- true if this download job has passed its expiration time, false otherwise
-
from
- Throws:
IllegalArgumentException
-
getMimeType
-