Class VersionManifest

java.lang.Object
ca.corbett.updates.VersionManifest

public class VersionManifest extends Object
Represents the version manifest for an application, with all of its versions and all of its extensions. The result of this is a version manifest json file that can be hosted somewhere and pointed to by the application's UpdateSources json. This allows the application to retrieve the VersionManifest dynamically, to learn about what extensions are available and what the latest version of each one is.

Example manifest

 {
   "manifestGenerated": "2025-10-16T00:53:33.946196621Z",
   "applicationName": "ExampleApplication",
   "applicationVersions": [
     {
       "version": "1.0",
       "extensions": [
         {
           "name": "MyFirstExtension",
           "versions": [
             {
               "extInfo:" { ... },
               "downloadPath": "MyFirstExtension-1.0.0.jar",
               "signaturePath": "MyFirstExtension-1.0.0.sig",
               "screenshots": [
                 "MyFirstExtension-1.0.0_screenshot1.jpg"
               ]
             },
             {
               "extInfo:" { ... },
               "downloadPath": "MyFirstExtension-1.0.1.jar",
               "signaturePath": "MyFirstExtension-1.0.1.sig",
               "screenshots": [
                 "MyFirstExtension-1.0.1_screenshot1.jpg",
                 "MyFirstExtension-1.0.1_screenshot2.png"
               ]
             }
           ]
         }
       ]
     }
   ]
 }
 

The above example shows a simple application VersionManifest with a single application version, which has a single extension called MyFirstExtension. This extension has two versions available, 1.0.0 and 1.0.1 - both of these versions have been digitally signed (we can tell this because they both provide a signaturePath to be used for verification of the jar).

Notice that all paths in the version manifest are relative! But relative to what? A VersionManifest can only properly be interpreted through an UpdateSource, which contains a baseUrl - all paths are relative to this baseUrl. The reason for this is that one application may have many UpdateSources, but we don't want to have to generate a VersionManifest for each one, when the contents would be identical except for file locations. So, we generate the VersionManifest just once, and an application can understand it in conjunction with the baseUrl from any corresponding UpdateSource.

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

    • VersionManifest

      public VersionManifest()
  • Method Details

    • fromFile

      public static VersionManifest fromFile(File sourceFile) throws IOException, com.google.gson.JsonSyntaxException
      Throws:
      IOException
      com.google.gson.JsonSyntaxException
    • fromJson

      public static VersionManifest fromJson(String json) throws com.google.gson.JsonSyntaxException
      Throws:
      com.google.gson.JsonSyntaxException
    • save

      public void save(File destFile) throws IOException
      Temp code? Authoring should move to ext-packager repo
      Throws:
      IOException
    • getManifestGenerated

      public Instant getManifestGenerated()
    • setManifestGenerated

      public void setManifestGenerated(String timestampString)
    • setManifestGenerated

      public void setManifestGenerated(Instant instant)
    • getManifestGeneratedAsLocalTime

      public LocalDateTime getManifestGeneratedAsLocalTime(ZoneId zoneId)
      Get the manifestGenerated timestamp in some local time zone, for example: ZoneId.of("America/Edmonton").
    • getApplicationName

      public String getApplicationName()
    • setApplicationName

      public void setApplicationName(String applicationName)
    • getApplicationVersions

      public List<VersionManifest.ApplicationVersion> getApplicationVersions()
      Returns a list of all ApplicationVersions for this Application.
    • getApplicationVersionsForMajorVersion

      public List<VersionManifest.ApplicationVersion> getApplicationVersionsForMajorVersion(int majorVersion)
      Returns a list of all ApplicationVersions for the given major version number of this Application.
    • getUniqueExtensionNames

      public List<String> getUniqueExtensionNames()
      Returns a list of all unique extension names across all application versions for this Application.
    • getUniqueExtensionNamesForMajorVersion

      public List<String> getUniqueExtensionNamesForMajorVersion(int majorVersion)
      Returns a list of all unique extension names for the given major version number of this Application.
    • getHighestVersionForExtension

      public Optional<VersionManifest.ExtensionVersion> getHighestVersionForExtension(String extensionName)
      Returns the highest ExtensionVersion for the given extension name, across all application versions.
    • getHighestVersionForExtensionInMajorAppVersion

      public Optional<VersionManifest.ExtensionVersion> getHighestVersionForExtensionInMajorAppVersion(String extensionName, int majorAppVersion)
      Returns the highest ExtensionVersion for the given extension name, across all application versions that match the given major version number.
    • getHighestExtensionVersionsForMajorAppVersion

      public List<VersionManifest.ExtensionVersion> getHighestExtensionVersionsForMajorAppVersion(int majorAppVersion)
      Returns a sorted list of the highest-version ExtensionVersion for each Extension that is available for the specified major version of this Application. The list is sorted by extension name.
    • findExtensionForExtensionVersion

      public Optional<VersionManifest.Extension> findExtensionForExtensionVersion(VersionManifest.ExtensionVersion extVersion)
      This is a bit wonky, but because ExtensionVersion does not know about the Extension that contains it, I have to have this lookup function to find the Extension for a given ExtensionVersion.
    • addApplicationVersion

      public void addApplicationVersion(VersionManifest.ApplicationVersion version)
    • removeApplicationVersion

      public void removeApplicationVersion(VersionManifest.ApplicationVersion version)
    • clearApplicationVersions

      public void clearApplicationVersions()
    • equals

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

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

      public VersionManifest.ApplicationVersion findLatestApplicationVersion()
      Returns the ApplicationVersion with the highest version number. Will return null if there are no ApplicationVersions here.