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 UpdateSites 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
Nested ClassesModifier and TypeClassDescriptionfinal classIn-memory representation of the update center data.static final classRepresents a deprecation of a certain component.static classstatic final classMetadata for one issue tracker provided by the update site.final classfinal classRepresents a warning about a certain component, mostly related to known security issues.static enumstatic final classA version range forWarnings indicates which versions of a given plugin are affected by it. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOpens a connection to the given URLprotected UpdateCenter.InstallationJobcreateInstallationJob(UpdateSite.Plugin plugin, UpdateCenter uc, boolean dynamicLoad) Extension point to allow implementations ofUpdateSiteto create a customUpdateCenter.InstallationJob.org.kohsuke.stapler.HttpResponseInvalidates 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.longDeprecated.Exposed only for UI.getId()Get ID string.net.sf.json.JSONObjectGets the raw update center JSON data.protected JSONSignatureValidatorDeprecated.usegetJsonSignatureValidator(String)instead.protected JSONSignatureValidatorLet 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.booleanDoes any of the plugin has updates?booleanisDue()Returns true if it's time for us to check for new version.booleanIs this the legacy default update center site?voidpreValidate(URL src) Validate the URL of the resource before downloading it.protected FormValidationupdateData(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 FormValidationverifySignatureInternal(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
-
connect
Opens a connection to the given URL- Parameters:
src- the url to connect to- Returns:
- A
URLConnectionfor the given src URL - Throws:
IOException- Since:
- 2.499
-
preValidate
Validate the URL of the resource before downloading it.- Parameters:
src- The location of the resource on the network- Throws:
IOException- if the validation fails- Since:
- 2.499
-
updateDirectlyNow
Forces an update of the data file from the configured URL, irrespective of the last time the data was retrieved.- Returns:
- A
FormValidationindicating 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 ofUpdateSiteto create a customUpdateCenter.InstallationJob.- Parameters:
plugin- the plugin to create theUpdateCenter.InstallationJobfor.uc- theUpdateCenter.dynamicLoad-trueif 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:
nullif 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
nullif 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
SetupWizardfor 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
-