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
  • Field Details

    • neverUpdate

      public static boolean neverUpdate
  • Constructor Details

  • Method Details

    • 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 with postMessage, 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.
      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 with postMessage, 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 of UpdateSite to create a custom UpdateCenter.InstallationJob.
      Parameters:
      plugin - the plugin to create the UpdateCenter.InstallationJob for.
      uc - the UpdateCenter.
      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.
      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 to PluginWrapper.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.
    • getSuggestedPluginsUrl

      @Exported public String 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 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