Class UpdateSources.UpdateSource

java.lang.Object
ca.corbett.updates.UpdateSources.UpdateSource
Enclosing class:
UpdateSources

public static class UpdateSources.UpdateSource extends Object
Represents a single remote update source, for use with the UpdateConfiguration class. There are two key pieces of information associated with a remote update source:
  • name: Some human-readable name for this data source.
  • baseUrl: The base url for this UpdateSource. All paths are relative to this url.
  • versionManifest: The relative path to the VersionManifest json file.
  • publicKey (optional): - the remote host can publish a public key to use for digital signature verification of downloaded extension jars. See SignatureUtil class for more details on signing and verifying files. This field is optional but highly recommended. Without it, jars will be downloaded and installed with no verification. This field represents the relative path to the public key.

This class has convenience methods that allow you to retrieve the versionManifest and the publicKey either as fully-qualified URLs (built using the value in baseUrl), or as relative paths (relative to the baseUrl).

Since:
swing-extras 2.5
Author:
scorbo2
  • Constructor Details

    • UpdateSource

      public UpdateSource(String name, URL baseUrl, String versionManifest)
      Create a new UpdateSource with the given baseUrl, versionManifest and no public key. Without a public key, digital signature verification will not be possible for extension jars downloaded from this remote source.
    • UpdateSource

      public UpdateSource(String name, URL baseUrl, String versionManifest, String publicKey)
      Creates an UpdateSource with the specified baseUrl, versionManifest, and public key.
  • Method Details

    • fromJson

      public static UpdateSources.UpdateSource fromJson(String json) throws com.google.gson.JsonParseException
      Factory method to generate an UpdateSource instance from the given raw json string, assuming that the json is well-formed and parseable.
      Throws:
      com.google.gson.JsonParseException
    • fromFile

      public static UpdateSources.UpdateSource fromFile(File file) throws IOException, com.google.gson.JsonParseException
      Factory method to generate an UpdateSource instance from the given json file, assuming that the file is readable and contains well-formed json.
      Throws:
      IOException
      com.google.gson.JsonParseException
    • getName

      public String getName()
    • getBaseUrl

      public URL getBaseUrl()
    • isLocalSource

      public boolean isLocalSource()
    • getVersionManifestRelativePath

      public String getVersionManifestRelativePath()
    • getVersionManifestUrl

      public URL getVersionManifestUrl()
    • hasPublicKey

      public boolean hasPublicKey()
    • getPublicKeyRelativePath

      public String getPublicKeyRelativePath()
    • getPublicKeyUrl

      public URL getPublicKeyUrl()
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object