Package hudson.model
Class UpdateCenter.DownloadJob
- java.lang.Object
-
- hudson.model.UpdateCenter.UpdateCenterJob
-
- hudson.model.UpdateCenter.DownloadJob
-
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
UpdateCenter.HudsonDowngradeJob,UpdateCenter.HudsonUpgradeJob,UpdateCenter.InstallationJob,UpdateCenter.PluginDowngradeJob
- Enclosing class:
- UpdateCenter
public abstract class UpdateCenter.DownloadJob extends UpdateCenter.UpdateCenterJob
Base class for a job that downloads a file from the Jenkins project.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classUpdateCenter.DownloadJob.FailureIndicates that the installation of a plugin failed.classUpdateCenter.DownloadJob.InstallationStatusIndicates the status or the result of a plugin installation.classUpdateCenter.DownloadJob.InstallingInstallation of a plugin is in progress.classUpdateCenter.DownloadJob.PendingIndicates that the plugin is waiting for its turn for installation.classUpdateCenter.DownloadJob.SkippedIndicates that the plugin was successfully installed.classUpdateCenter.DownloadJob.SuccessIndicates that the plugin was successfully installed.classUpdateCenter.DownloadJob.SuccessButRequiresRestartIndicates that the installation was successful but a restart is needed.
-
Field Summary
Fields Modifier and Type Field Description UpdateCenter.DownloadJob.InstallationStatusstatusImmutable object representing the current state of this job.-
Fields inherited from class hudson.model.UpdateCenter.UpdateCenterJob
error, id, site
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDownloadJob(UpdateSite site, org.springframework.security.core.Authentication authentication)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void_run()StringgetComputedSHA1()During download, an attempt is made to compute the SHA-1 checksum of the file.StringgetComputedSHA256()Base64 encoded SHA-256 checksum of the downloaded file, if it could be computed.StringgetComputedSHA512()Base64 encoded SHA-512 checksum of the downloaded file, if it could be computed.longgetContentLength()Indicate the expected size of the download as provided in update site metadata.protected abstract FilegetDestination()Where to download the file to.StringgetDisplayName()Display name used for the GUI.abstract StringgetName()Code name used for logging.protected abstract URLgetURL()Where to download the file from.org.springframework.security.core.AuthenticationgetUser()Get the user that initiated this jobprotected abstract voidonSuccess()Called when the whole thing went successfully.protected voidreplace(File dst, File src)Called when the download is completed to overwrite the old file with the new file.voidrun()-
Methods inherited from class hudson.model.UpdateCenter.UpdateCenterJob
getApi, getCorrelationId, getError, getErrorMessage, getType, schedule, setCorrelationId, submit
-
-
-
-
Field Detail
-
status
@Exported(inline=true) public volatile UpdateCenter.DownloadJob.InstallationStatus status
Immutable object representing the current state of this job.
-
-
Constructor Detail
-
DownloadJob
protected DownloadJob(UpdateSite site, org.springframework.security.core.Authentication authentication)
-
-
Method Detail
-
getURL
protected abstract URL getURL() throws MalformedURLException
Where to download the file from.- Throws:
MalformedURLException
-
getDestination
protected abstract File getDestination()
Where to download the file to.
-
getName
@Exported public abstract String getName()
Code name used for logging.
-
getDisplayName
public String getDisplayName()
Display name used for the GUI.- Since:
- 2.189
-
onSuccess
protected abstract void onSuccess()
Called when the whole thing went successfully.
-
getComputedSHA1
@CheckForNull public String getComputedSHA1()
During download, an attempt is made to compute the SHA-1 checksum of the file. This is the base64 encoded SHA-1 checksum.- Since:
- 1.641
-
getComputedSHA256
@CheckForNull public String getComputedSHA256()
Base64 encoded SHA-256 checksum of the downloaded file, if it could be computed.- Since:
- 2.130
-
getComputedSHA512
@CheckForNull public String getComputedSHA512()
Base64 encoded SHA-512 checksum of the downloaded file, if it could be computed.- Since:
- 2.130
-
getUser
public org.springframework.security.core.Authentication getUser()
Get the user that initiated this job
-
_run
protected void _run() throws IOException, UpdateCenter.DownloadJob.InstallationStatus
-
replace
protected void replace(File dst, File src) throws IOException
Called when the download is completed to overwrite the old file with the new file.- Throws:
IOException
-
getContentLength
public long getContentLength()
Indicate the expected size of the download as provided in update site metadata.- Returns:
- the expected size, or -1 if unknown.
- Since:
- 2.325
-
-