Top Inners Fields Constructors Methods
org.jabref.gui.linkedfile

public Class DownloadLinkedFileAction

extends SimpleCommand
Class Inheritance
Imports
java.io.IOException, java.net.MalformedURLException, .URL, java.nio.file.Files, .Path, .StandardCopyOption, java.util.ArrayList, .List, .Optional, javax.net.ssl.HostnameVerifier, .HttpsURLConnection, .SSLHandshakeException, .SSLSocketFactory, javafx.beans.property.DoubleProperty, .ReadOnlyDoubleProperty, .SimpleDoubleProperty, org.jabref.gui.DialogService, .LibraryTab, org.jabref.gui.actions.SimpleCommand, org.jabref.gui.externalfiletype.ExternalFileType, .ExternalFileTypes, .StandardExternalFileType, org.jabref.gui.fieldeditors.LinkedFilesEditorViewModel, .URLUtil, org.jabref.gui.util.BackgroundTask, .TaskExecutor, org.jabref.logic.externalfiles.LinkedFileHandler, org.jabref.logic.importer.FetcherClientException, .FetcherServerException, org.jabref.logic.l10n.Localization, org.jabref.logic.net.ProgressInputStream, .URLDownload, org.jabref.logic.util.io.FileNameUniqueness, .FileUtil, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .LinkedFile, org.jabref.preferences.FilePreferences, com.tobiasdiez.easybind.EasyBind, kong.unirest.core.UnirestException, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final DialogService
private final DoubleProperty
private final String
private final BibEntry
private final FilePreferences
private final boolean
private final LinkedFile
private final LinkedFileHandler
private static final Logger
private final String
private final TaskExecutor
Inherited from org.jabref.gui.actions.SimpleCommand:
statusMessage

Constructor Summary

AccessConstructor and Description
public
DownloadLinkedFileAction(BibDatabaseContext databaseContext, BibEntry entry, LinkedFile linkedFile, String downloadUrl, DialogService dialogService, FilePreferences filePreferences, TaskExecutor taskExecutor, String suggestedName, boolean keepHtmlLink)

public
DownloadLinkedFileAction(BibDatabaseContext databaseContext, BibEntry entry, LinkedFile linkedFile, String downloadUrl, DialogService dialogService, FilePreferences filePreferences, TaskExecutor taskExecutor)

Downloads the given linked file to the first existing file directory.

Method Summary

Modifier and TypeMethod and Description
private boolean
private void
doDownload(Path targetDirectory, URLDownload urlDownload)

public ReadOnlyDoubleProperty
public void
private Optional<ExternalFileType>
private Optional<ExternalFileType>
private Optional<ExternalFileType>
private void
onFailure(URLDownload urlDownload, Exception ex)

private void
onSuccess(Path
The directory to store the file into. Is an absolute path.
targetDirectory
,
Path downloadedFile)

private BackgroundTask<Path>
prepareDownloadTask(Path targetDirectory, URLDownload urlDownload)

Inherited from org.jabref.gui.actions.SimpleCommand:
getProgressprogressPropertysetExecutablestatusMessageProperty

Field Detail

databaseContextback to summary
private final BibDatabaseContext databaseContext
dialogServiceback to summary
private final DialogService dialogService
downloadProgressback to summary
private final DoubleProperty downloadProgress
downloadUrlback to summary
private final String downloadUrl
entryback to summary
private final BibEntry entry
filePreferencesback to summary
private final FilePreferences filePreferences
linkedFileback to summary
private final LinkedFile linkedFile
linkedFileHandlerback to summary
private final LinkedFileHandler linkedFileHandler
LOGGERback to summary
private static final Logger LOGGER
suggestedNameback to summary
private final String suggestedName
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

DownloadLinkedFileActionback to summary
public DownloadLinkedFileAction(BibDatabaseContext databaseContext, BibEntry entry, LinkedFile linkedFile, String downloadUrl, DialogService dialogService, FilePreferences filePreferences, TaskExecutor taskExecutor, String suggestedName, boolean keepHtmlLink)
DownloadLinkedFileActionback to summary
public DownloadLinkedFileAction(BibDatabaseContext databaseContext, BibEntry entry, LinkedFile linkedFile, String downloadUrl, DialogService dialogService, FilePreferences filePreferences, TaskExecutor taskExecutor)

Downloads the given linked file to the first existing file directory. It keeps HTML files as URLs.

Method Detail

checkSSLHandshakeback to summary
private boolean checkSSLHandshake(URLDownload urlDownload)
doDownloadback to summary
private void doDownload(Path targetDirectory, URLDownload urlDownload)
downloadProgressback to summary
public ReadOnlyDoubleProperty downloadProgress()
executeback to summary
public void execute()
Annotations
@Override
inferFileTypeback to summary
private Optional<ExternalFileType> inferFileType(URLDownload urlDownload)
inferFileTypeFromMimeTypeback to summary
private Optional<ExternalFileType> inferFileTypeFromMimeType(URLDownload urlDownload)
inferFileTypeFromURLback to summary
private Optional<ExternalFileType> inferFileTypeFromURL(String url)
onFailureback to summary
private void onFailure(URLDownload urlDownload, Exception ex)
onSuccessback to summary
private void onSuccess(Path targetDirectory, Path downloadedFile)
Parameters
targetDirectory:Path

The directory to store the file into. Is an absolute path.

prepareDownloadTaskback to summary
private BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownload urlDownload)
org.jabref.gui.linkedfile back to summary

private Class DownloadLinkedFileAction.FileDownloadTask

extends BackgroundTask<Path>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Path
private final URL
Inherited from org.jabref.gui.util.BackgroundTask:
iconMap

Constructor Summary

AccessConstructor and Description
public
FileDownloadTask(URL source, Path destination)

Method Summary

Modifier and TypeMethod and Description
protected Path
Inherited from org.jabref.gui.util.BackgroundTask:
cancelexecuteWithgetIcongetProgressgetWorkDonePercentageisCanceledisCanceledPropertymessagePropertyonFailureonFinishedonRunningonSuccessprogressPropertyscheduleWithshowToUsershowToUserthenthenRunthenRuntitlePropertyupdateMessageupdateProgressupdateProgresswillBeRecoveredAutomaticallywillBeRecoveredAutomaticallywithInitialMessageworkDonePercentagePropertywrapwrap

Field Detail

destinationback to summary
private final Path destination
sourceback to summary
private final URL source

Constructor Detail

FileDownloadTaskback to summary
public FileDownloadTask(URL source, Path destination)

Method Detail

callback to summary
protected Path call() throws Exception

Implements abstract org.jabref.gui.util.BackgroundTask.call.

Annotations
@Override