Package hudson.model
Class UpdateSite
- java.lang.Object
-
- hudson.model.UpdateSite
-
@ExportedBean public class UpdateSite extends Object
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 Classes Modifier and Type Class Description classUpdateSite.DataIn-memory representation of the update center data.static classUpdateSite.DeprecationRepresents a deprecation of a certain component.static classUpdateSite.Entrystatic classUpdateSite.IssueTrackerMetadata for one issue tracker provided by the update site.classUpdateSite.PluginclassUpdateSite.WarningRepresents a warning about a certain component, mostly related to known security issues.static classUpdateSite.WarningTypestatic classUpdateSite.WarningVersionRangeA version range forWarnings indicates which versions of a given plugin are affected by it.
-
Field Summary
Fields Modifier and Type Field Description static booleanneverUpdate
-
Constructor Summary
Constructors Constructor Description UpdateSite(String id, String url)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected UpdateCenter.InstallationJobcreateInstallationJob(UpdateSite.Plugin plugin, UpdateCenter uc, boolean dynamicLoad)Extension point to allow implementations ofUpdateSiteto create a customUpdateCenter.InstallationJob.org.kohsuke.stapler.HttpResponsedoInvalidateData()Invalidates the cached data and force retrieval.FormValidationdoVerifySignature()ApigetApi()List<UpdateSite.Plugin>getAvailables()Returns a list of plugins that should be shown in the "available" tab.StringgetConnectionCheckUrl()Gets a URL for the Internet connection check.UpdateSite.DatagetData()Loads the update center data, if any.longgetDataTimestamp()StringgetDownloadUrl()Deprecated.Exposed only for UI.StringgetId()Get ID string.net.sf.json.JSONObjectgetJSONObject()Gets the raw update center JSON data.protected JSONSignatureValidatorgetJsonSignatureValidator()Deprecated.usegetJsonSignatureValidator(String)instead.protected JSONSignatureValidatorgetJsonSignatureValidator(String name)Let sub-classes of UpdateSite provide their own signature validator.StringgetMetadataUrlForDownloadable(String downloadable)URL which exposes the metadata location in a specific update site.UpdateSite.PlugingetPlugin(String artifactId)Gets the information about a specific plugin.StringgetSuggestedPluginsUrl()List<UpdateSite.Plugin>getUpdates()Returns the list of plugins that are updates to currently installed ones.StringgetUrl()Exposed to get rid of hardcoding of the URL that serves up update-center.json in JavaScript.booleanhasUpdates()Does any of the plugin has updates?booleanisDue()Returns true if it's time for us to check for new version.booleanisLegacyDefault()Deprecated.Will be removed, currently returns always false.Future<FormValidation>updateDirectly()Update the data file from the given URL if the file does not exist, or is otherwise due for update.Future<FormValidation>updateDirectly(boolean signatureCheck)Deprecated.use updateDirectly()FormValidationupdateDirectlyNow()Forces an update of the data file from the configured URL, irrespective of the last time the data was retrieved.FormValidationupdateDirectlyNow(boolean signatureCheck)FormValidationverifySignatureInternal(net.sf.json.JSONObject o)Verifies the signature in the update center data file.
-
-
-
Method Detail
-
getId
@Exported public String getId()
Get ID string.
-
getDataTimestamp
@Exported public long getDataTimestamp()
-
updateDirectly
@CheckForNull public Future<FormValidation> 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 @CheckForNull public Future<FormValidation> updateDirectly(boolean signatureCheck)
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
@NonNull public FormValidation updateDirectlyNow() throws IOException
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
-
doVerifySignature
public FormValidation doVerifySignature() throws IOException
- 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 @NonNull protected JSONSignatureValidator getJsonSignatureValidator()
Deprecated.usegetJsonSignatureValidator(String)instead.Let sub-classes of UpdateSite provide their own signature validator.- Returns:
- the signature validator.
-
getJsonSignatureValidator
@NonNull protected JSONSignatureValidator getJsonSignatureValidator(@CheckForNull String name)
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
@CheckForNull public UpdateSite.Data 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
@Exported public List<UpdateSite.Plugin> getAvailables()
Returns a list of plugins that should be shown in the "available" tab. These are "all plugins - installed plugins".
-
getPlugin
@CheckForNull public UpdateSite.Plugin getPlugin(String artifactId)
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
public Api getApi()
-
getConnectionCheckUrl
@Exported @CheckForNull public String 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
@Exported public List<UpdateSite.Plugin> 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
@Exported public String getUrl()
Exposed to get rid of hardcoding of the URL that serves up update-center.json in JavaScript.
-
getSuggestedPluginsUrl
@Exported public String 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 public String getDownloadUrl()
Deprecated.Exposed only for UI.Where to actually download the update center?
-
isLegacyDefault
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isLegacyDefault()
Deprecated.Will be removed, currently returns always false.Is this the legacy default update center site?- Since:
- 2.343
-
-