Class UpdateSources

java.lang.Object
ca.corbett.updates.UpdateSources

public class UpdateSources extends Object
Your application can package a json file which represents one or more "update sources" - that is, remote URLs where your application can check for new versions, and also to enable discovery and installation of new extensions, or new versions of already-installed extensions. To enable this feature, package an update configuration json file with your application, as shown in the following example:
     {
         "applicationName": "MyAmazingApplication",
         "updateSources": [
             {
                 "name": "Web server at www.test.example",
                 "baseUrl": "http://www.test.example/MyAmazingApplication/",
                 "versionManifest": "version_manifest.json",
                 "publicKey": "public.key"
             }
         ]
     }
 

The above example shows an application with a single remote update source. The public key is optional, but recommended to allow for digital signature verification on downloaded extension jars.

Where's all the information detailing my extensions? - that information is NOT bundled with the application, because the whole idea is that you can release new extensions AFTER your application has shipped. The UpdateManager class will read the version manifest pointed to by the update sources json, and will be able to dynamically discover new extensions and new versions of existing extensions. The version manifest can be updated after the application is released, with no changes needed on the client side.

How do I set all this up? - There's a helper application called ExtPackager that can walk you through the process of setting up your UpdateSources json and your VersionManifest, and can also help you with things like digitally signing your extension jars, providing screenshots for each version, and uploading to your web host via FTP. You don't have to write this json by hand!

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

    • UpdateSources

      public UpdateSources(String applicationName)
  • Method Details

    • fromJson

      public static UpdateSources fromJson(String json) throws com.google.gson.JsonParseException
      Factory method to generate an UpdateSources 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 fromFile(File file) throws IOException, com.google.gson.JsonParseException
      Factory method to generate an UpdateSources instance from the given json file, assuming that the file is readable and contains well-formed json.
      Throws:
      IOException
      com.google.gson.JsonParseException
    • getApplicationName

      public String getApplicationName()
    • getUpdateSources

      public List<UpdateSources.UpdateSource> getUpdateSources()
    • addUpdateSource

      public void addUpdateSource(UpdateSources.UpdateSource updateSource)
    • isAllowSnapshots

      public boolean isAllowSnapshots()
    • setAllowSnapshots

      public void setAllowSnapshots(boolean allowSnapshots)
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object