Package hudson.model
Class UpdateSite
java.lang.Object
hudson.model.UpdateSite
Source of the update center information, like "http://jenkins-ci.org/update-center.json"
Jenkins can have multiple UpdateSite
s registered in the system, so that it can pick up plugins
from different locations.
- Since:
- 1.333
- Author:
- Andrew Bayer, Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
In-memory representation of the update center data.static final class
Represents a deprecation of a certain component.static class
static final class
Metadata for one issue tracker provided by the update site.final class
final class
Represents a warning about a certain component, mostly related to known security issues.static enum
static final class
A version range forWarning
s indicates which versions of a given plugin are affected by it. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected UpdateCenter.InstallationJob
createInstallationJob
(UpdateSite.Plugin plugin, UpdateCenter uc, boolean dynamicLoad) Extension point to allow implementations ofUpdateSite
to create a customUpdateCenter.InstallationJob
.org.kohsuke.stapler.HttpResponse
Invalidates the cached data and force retrieval.getApi()
Returns a list of plugins that should be shown in the "available" tab.Gets a URL for the Internet connection check.getData()
Loads the update center data, if any.long
Deprecated.Exposed only for UI.getId()
Get ID string.net.sf.json.JSONObject
Gets the raw update center JSON data.protected JSONSignatureValidator
Deprecated.usegetJsonSignatureValidator(String)
instead.protected JSONSignatureValidator
Let sub-classes of UpdateSite provide their own signature validator.getMetadataUrlForDownloadable
(String downloadable) URL which exposes the metadata location in a specific update site.Gets the information about a specific plugin.Returns the list of plugins that are updates to currently installed ones.getUrl()
Exposed to get rid of hardcoding of the URL that serves up update-center.json in JavaScript.boolean
Does any of the plugin has updates?boolean
isDue()
Returns true if it's time for us to check for new version.boolean
Is this the legacy default update center site?protected FormValidation
updateData
(String json, boolean signatureCheck) Update the data file from the given URL if the file does not exist, or is otherwise due for update.updateDirectly
(boolean signatureCheck) Deprecated.use updateDirectly()Forces an update of the data file from the configured URL, irrespective of the last time the data was retrieved.updateDirectlyNow
(boolean signatureCheck) final FormValidation
verifySignatureInternal
(net.sf.json.JSONObject o) Verifies the signature in the update center data file.
-
Field Details
-
neverUpdate
public static boolean neverUpdate
-
-
Constructor Details
-
UpdateSite
-
-
Method Details
-
getId
Get ID string. -
getDataTimestamp
@Exported public long getDataTimestamp() -
updateDirectly
Update the data file from the given URL if the file does not exist, or is otherwise due for update. Accepted formats are JSONP or HTML withpostMessage
, not raw JSON.- Returns:
- null if no updates are necessary, or the future result
- Since:
- 2.222
-
updateDirectly
Deprecated.use updateDirectly()Update the data file from the given URL if the file does not exist, or is otherwise due for update. Accepted formats are JSONP or HTML withpostMessage
, not raw JSON.- Parameters:
signatureCheck
- whether to enforce the signature (may be off only for testing!)- Returns:
- null if no updates are necessary, or the future result
- Since:
- 1.502
-
updateDirectlyNow
Forces an update of the data file from the configured URL, irrespective of the last time the data was retrieved.- Returns:
- A
FormValidation
indicating the if the update metadata was successfully downloaded from the configured update site - Throws:
IOException
- if there was an error downloading or saving the file.- Since:
- 2.222
-
updateDirectlyNow
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public FormValidation updateDirectlyNow(boolean signatureCheck) throws IOException - Throws:
IOException
-
updateData
- Throws:
IOException
-
doVerifySignature
- Throws:
IOException
-
createInstallationJob
protected UpdateCenter.InstallationJob createInstallationJob(UpdateSite.Plugin plugin, UpdateCenter uc, boolean dynamicLoad) Extension point to allow implementations ofUpdateSite
to create a customUpdateCenter.InstallationJob
.- Parameters:
plugin
- the plugin to create theUpdateCenter.InstallationJob
for.uc
- theUpdateCenter
.dynamicLoad
-true
if the plugin should be attempted to be dynamically loaded.- Returns:
- the
UpdateCenter.InstallationJob
. - Since:
- 2.9
-
verifySignatureInternal
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final FormValidation verifySignatureInternal(net.sf.json.JSONObject o) throws IOException Verifies the signature in the update center data file.- Throws:
IOException
-
getJsonSignatureValidator
Deprecated.usegetJsonSignatureValidator(String)
instead.Let sub-classes of UpdateSite provide their own signature validator.- Returns:
- the signature validator.
-
getJsonSignatureValidator
Let sub-classes of UpdateSite provide their own signature validator.- Parameters:
name
- the name for the JSON signature Validator object. if name is null, then the default name will be used, which is "update site" followed by the update site id- Returns:
- the signature validator.
- Since:
- 2.21
-
isDue
public boolean isDue()Returns true if it's time for us to check for new version. -
doInvalidateData
public org.kohsuke.stapler.HttpResponse doInvalidateData()Invalidates the cached data and force retrieval.- Since:
- 1.432
-
getData
Loads the update center data, if any.- Returns:
- null if no data is available.
-
getJSONObject
public net.sf.json.JSONObject getJSONObject()Gets the raw update center JSON data. -
getAvailables
Returns a list of plugins that should be shown in the "available" tab. These are "all plugins - installed plugins". -
getPlugin
Gets the information about a specific plugin.- Parameters:
artifactId
- The short name of the plugin. Corresponds toPluginWrapper.getShortName()
.- Returns:
null
if no such information is found.
-
getApi
-
getConnectionCheckUrl
Gets a URL for the Internet connection check.- Returns:
- an "always up" server for Internet connectivity testing, or
null
if we are going to skip the test.
-
getUpdates
Returns the list of plugins that are updates to currently installed ones.- Returns:
- can be empty but never null.
-
hasUpdates
@Exported public boolean hasUpdates()Does any of the plugin has updates? -
getUrl
Exposed to get rid of hardcoding of the URL that serves up update-center.json in JavaScript. -
getSuggestedPluginsUrl
- Returns:
- the URL used by
SetupWizard
for suggested plugins to install at setup time - Since:
- 2.446
-
getMetadataUrlForDownloadable
@CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getMetadataUrlForDownloadable(String downloadable) URL which exposes the metadata location in a specific update site.- Parameters:
downloadable
- the downloadable id of a specific metatadata json (e.g. hudson.tasks.Maven.MavenInstaller.json)- Returns:
- the location
- Since:
- 2.20
-
getDownloadUrl
Deprecated.Exposed only for UI.Where to actually download the update center? -
isLegacyDefault
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isLegacyDefault()Is this the legacy default update center site?- Since:
- 1.357
-