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
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
Nested Classes Modifier and Type Class Description class
UpdateSite.Data
In-memory representation of the update center data.static class
UpdateSite.Deprecation
Represents a deprecation of a certain component.static class
UpdateSite.Entry
static class
UpdateSite.IssueTracker
Metadata for one issue tracker provided by the update site.class
UpdateSite.Plugin
class
UpdateSite.Warning
Represents a warning about a certain component, mostly related to known security issues.static class
UpdateSite.WarningType
static class
UpdateSite.WarningVersionRange
A version range forWarning
s indicates which versions of a given plugin are affected by it.
-
Field Summary
Fields Modifier and Type Field Description static boolean
neverUpdate
-
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.InstallationJob
createInstallationJob(UpdateSite.Plugin plugin, UpdateCenter uc, boolean dynamicLoad)
Extension point to allow implementations ofUpdateSite
to create a customUpdateCenter.InstallationJob
.org.kohsuke.stapler.HttpResponse
doInvalidateData()
Invalidates the cached data and force retrieval.FormValidation
doVerifySignature()
Api
getApi()
List<UpdateSite.Plugin>
getAvailables()
Returns a list of plugins that should be shown in the "available" tab.String
getConnectionCheckUrl()
Gets a URL for the Internet connection check.UpdateSite.Data
getData()
Loads the update center data, if any.long
getDataTimestamp()
String
getDownloadUrl()
Deprecated.Exposed only for UI.String
getId()
Get ID string.net.sf.json.JSONObject
getJSONObject()
Gets the raw update center JSON data.protected JSONSignatureValidator
getJsonSignatureValidator()
Deprecated.usegetJsonSignatureValidator(String)
instead.protected JSONSignatureValidator
getJsonSignatureValidator(String name)
Let sub-classes of UpdateSite provide their own signature validator.String
getMetadataUrlForDownloadable(String downloadable)
URL which exposes the metadata location in a specific update site.UpdateSite.Plugin
getPlugin(String artifactId)
Gets the information about a specific plugin.List<UpdateSite.Plugin>
getUpdates()
Returns the list of plugins that are updates to currently installed ones.String
getUrl()
Exposed to get rid of hardcoding of the URL that serves up update-center.json in JavaScript.boolean
hasUpdates()
Does any of the plugin has updates?boolean
isDue()
Returns true if it's time for us to check for new version.boolean
isLegacyDefault()
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()FormValidation
updateDirectlyNow()
Forces an update of the data file from the configured URL, irrespective of the last time the data was retrieved.FormValidation
updateDirectlyNow(boolean signatureCheck)
FormValidation
verifySignatureInternal(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
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
-
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 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 @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:
null
if 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
null
if 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.
-
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
-
-